Skip to content

This is my short library for socket connection in cpp.Learnt from youtube

Notifications You must be signed in to change notification settings

Superb-Man/cpp-Console-chat-and-Threads

Repository files navigation

cpp Console Chat

This repository contains networking tasks in C++. The Socket and ServerSocket headers are implemented.One can use it for purposes. Or implement in other way. The TCP_Server_Client program is only for the chat between server and client ! The Messenger Program is for several clients communication through a TCP server. The number of clients,delete,free,remove all are ignored here/unhandled.

TCP_Server_Client 1

Screenshot (285)

Console Messenger

Screenshot (290)

/after closing one****/

Screenshot (291)

You can run the messenger opening the exe files from debug(ofcourse server at first) and copy the client exe and run it for multiple times without closing the previous. Or you can open solutions from both server and client then run server and run multiple instance of client side.

Server Socket

-  create a socket .
-  start server readthread and writethread (If TCP forwarding server , then writethread not much mandatory) .
-  bind to an address - What port am I on ?
-  listen on a port, and wait for a connection to be established.
-  accept the connection from a client.
-  send/recv - to read and write . 
-  shutdown to end read/write.
-  terminate the threads(join) .
-  close to release data .

   For multiple client sockets use " Socket* or list or array of Socket instead of Socket " .

Client Socket

-  create a socket 
-  connect to a server .
-  start read and write threads for client side .
-  send/recv - repeat until we have or receive data .
-  shutdown to end read/write .
-  terminate the threads(join) .
-  close to releases data .

Resource

https://docs.microsoft.com/en-us/windows/win32/api/winsock2/

About

This is my short library for socket connection in cpp.Learnt from youtube

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published