/WinSockServer

Example of WinSock server side. For Seminaire de langages de programmation.

Primary LanguageC

Server WINSOCK Example of server in C.

The server open socket, using WINSOCK, and with while(TRUE) is always in listening mode to socket, in order to wait a connection from client. The server sends a GREETING to client. The server receive a GREETING by client and saves the message in connection.txt file. If file doesn't exists, server creates its.

LINKS

Socket example and other information

Code Block with GCC G++ compiler and GDB debugger Official

Code Block with GCC G++ compiler and GDB debugger Direct Download

Download MinGW-w64

INSTALLATION

  1. Install CLion
  • Create new student account https://www.jetbrains.com/student/ or https://www.jetbrains.com/shop/eform/students

  • Insert your university email

  • Download the IDE

  • Download the code as ZIP

  • Extract zip in a folder

  • Import project as "New CMake Project from Source". Chose and select the project, navigating inside your file system. Fianlly import as "Open Existing Project".

  • Download and install MinGW-w64

  • Set Toolchains. File -> Settings -> Build, Execution, Deployment -> Toolchais. Click on '+'. Automatically, CLion sets up toolchains

figure

  1. Install CodeBlocks
  • Use Code Block with GCC/G++ compiler and GDB debugger (Direct Download) link

  • Install application

  • Set up linker: Settings -> Compiler -> Linker settings -> Add

  • Add C:\windows\system32\wsock32.dll libraries

figure

  • You can click on "Build and Run" button to launch server

figure

  • You can run application from file system

figure

TEST

  1. NMAP TOOL Download nmap for Windows platform, clicking on Latest stable release self-installer, from the follow link Open new terminal session and launch the follow command
ncat 127.0.0.1 8010

Write your messages from server and press ENTER to send to server.

  1. USE CLIENT PROGRAM Download, compile, build and run the WINSOCK CLIENT program, written in C, which is available in WINCLIENTSOCKET repository, link

Authors

  • Benedetto Marco Serinelli - Initial work

Acknowledgments

The code was developed with CLion and another test was done with Code Blocks.