{"id":26155491,"url":"https://github.com/ntdls/csocketserver","last_synced_at":"2026-02-25T21:05:15.266Z","repository":{"id":95158745,"uuid":"128976390","full_name":"NTDLS/CSocketServer","owner":"NTDLS","description":"Library to manage client/server connectivity and communication in a C++ project.","archived":false,"fork":false,"pushed_at":"2025-04-16T20:51:23.000Z","size":90,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-10T00:29:16.461Z","etag":null,"topics":["library","socket","win32api"],"latest_commit_sha":null,"homepage":"https://networkdls.com/Entity/csocketserver","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NTDLS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-04-10T18:12:36.000Z","updated_at":"2025-05-24T17:14:29.000Z","dependencies_parsed_at":"2025-03-11T08:56:44.995Z","dependency_job_id":"046b7e3c-bae4-42ef-bf00-44262939417b","html_url":"https://github.com/NTDLS/CSocketServer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NTDLS/CSocketServer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NTDLS%2FCSocketServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NTDLS%2FCSocketServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NTDLS%2FCSocketServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NTDLS%2FCSocketServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NTDLS","download_url":"https://codeload.github.com/NTDLS/CSocketServer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NTDLS%2FCSocketServer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29839969,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T20:42:33.054Z","status":"ssl_error","status_checked_at":"2026-02-25T20:42:21.322Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","socket","win32api"],"created_at":"2025-03-11T08:56:39.598Z","updated_at":"2026-02-25T21:05:15.242Z","avatar_url":"https://github.com/NTDLS.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSocketServer\n  \n:loudspeaker:\tA collection of classes for creating a socket server, client and communicating between them. Includes a Packetizer to solve the age old issue of TCP/IP packets being fragmented or combined in the pipe.\n  \nMust include WS2_32.LIB and/or WSOCK32.LIB\n  \n| Name                | Prototype                                                                                          | Return                                                  | Description                                                                                                                                                                                                                  |\n|---------------------|----------------------------------------------------------------------------------------------------|----------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| OnAccept            | bool OnAccept(CSocketServer *pSock, CSocketClient *pClient)                                       | Return TRUE to allow the connection, FALSE to reject.    | Called when a connection is accepted by the socket server.                                                                                                                                                                   |\n| OnAcceptConnect     | bool OnAcceptConnect(CSocketServer *pSock, CSocketClient *pClient)                                | Return TRUE to allow the connection, FALSE to reject.    | Called when a connection is accepted and/or connected by the socket server.                                                                                                                                                   |\n| OnAfterDePacketize  | bool OnAfterDePacketize(CSocketServer *pSock, CSocketClient *pClient, LPBASICHUNK pChunk)         | Return TRUE to accept the packet, FALSE to reject.       | Called after a packet is read by user code, pChunk contains the actual data sent by the remote peer.                                                                                                                        |\n| OnAfterPacketize    | bool OnAfterPacketize(CSocketServer *pSock, CSocketClient *pClient, LPBASICHUNK pChunk)           | Return TRUE to add to the send queue, FALSE to reject.   | Called after a packet is assembled by the socket server, pChunk contains the packet data and the data to be sent.                                                                                                           |\n| OnBeforeDePacketize | bool OnBeforeDePacketize(CSocketServer *pSock, CSocketClient *pClient, LPBASICHUNK pChunk)        | Return TRUE to accept the packet, FALSE to reject.       | Called before a packet is read by user code, pChunk contains the data sent by the remote peer.                                                                                                                               |\n| OnBeforePacketize   | bool OnBeforePacketize(CSocketServer *pSock, CSocketClient *pClient, LPBASICHUNK pChunk)          | Return TRUE to add to the send queue, FALSE to reject.   | Called before a packet is assembled by the socket server, pChunk contains the data to be sent.                                                                                                                               |\n| OnConnect           | bool OnConnect(CSocketServer *pSock, CSocketClient *pClient)                                      | Return TRUE to allow the connection, FALSE to reject.    | Called when a connection is connected by the socket server.                                                                                                                                                                  |\n| OnRecv              | bool OnRecv(CSocketServer *pSock, CSocketClient *pClient, LPBASICHUNK pChunk)                     | Return TRUE to accept the data, FALSE to reject.         | Called after a packet or partial packet is received, pChunk may not contain a full packet.                                                                                                                                   |\n| OnSend              | bool OnSend(CSocketServer *pSock, CSocketClient *pClient, LPBASICHUNK pChunk)                     | Return TRUE to send the data, FALSE to delay sending.    | Called before a packet is sent, pChunk contains the packet and actual data, guaranteed to be a full packet.                                                                                                                 |\n| OnStart             | bool OnStart(CSocketServer *pSock, int iListenPort)                                               | Return TRUE to start, FALSE to cancel.                   | Called when the socket server is started by a call to Start().                                                                                                                                                               |\n| OnStop              | bool OnStop(CSocketServer *pSock)                                                                 | Return TRUE to stop, FALSE to cancel.                    | Called when the socket server is stopped by a call to Stop().                                                                                                                                                                |\n| ClientHandlerThread | void ClientHandlerThread(CSocketServer *pSock, CSocketClient *pClient, LPBASICHUNK pChunk)        | n/a                                                      | Called when a client is accepted/connected, server enters \"one thread per connection\" mode, thread exits = client disconnect.                                                                                               |\n| OnBeginClientThread | void OnBeginClientThread(CSocketServer *pSock, CSocketClient *pClient, HANDLE hThread)            | n/a                                                      | Called after a client thread is created, before ClientHandlerThread is called.                                                                                                                                               |\n| OnDisconnect        | void OnDisconnect(CSocketServer *pSock, CSocketClient *pClient)                                   | n/a                                                      | Called when a client has been disconnected (after socket shutdown).                                                                                                                                                          |\n| OnEndClientThread   | void OnEndClientThread(CSocketServer *pSock, CSocketClient *pClient)                              | n/a                                                      | Called after a client thread has been destroyed.                                                                                                                                                                              |\n| OnError             | void OnError(CSocketServer *pSock, CSocketClient *pClient, int iErrorNumber, const char *sErrorMsg)| n/a                                                      | Called for any internal exceptions.                                                                                                                                                                                           |\n## Running Example\n![SocketServer](https://github.com/user-attachments/assets/c509dafc-e570-4749-9a8d-aa82bcbd420e)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntdls%2Fcsocketserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fntdls%2Fcsocketserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntdls%2Fcsocketserver/lists"}