vc++tcp network communication server + client (with source code)

VC++ commonly used functions package code a series of articles and source code (advertisement, haha, look at the series and then decide whether to subscribe)

https://blog.csdn.net/kaizi318/article/details/108846326

The source code demo has been uploaded to the Baidu network disk: permanently effective, the code implements the TCP server function and the TCP client function

This code is no problem for large and small data transmission, and it is applied to LAN audio and video transmission without any problems!

The package is CAsyncSocket, with detailed comments, absolutely usable, and absolutely open source!

Come directly on the code:

#pragma once
namespace TSock 
{
    typedef void (*TSockCB)(LPCSTR szId, BYTE* pData, int nLen); 

    // server-side function

    // Initialize the socket server
    extern "C" BOOL PASCAL TSInit(int nPort);

    // Exit the socket server
    extern "C" void PASCAL TSExit();

    // Set the callback function for processing data
    extern "C" void PASCAL TSSetCB(TSockCB pCB);

    // Broadcast message
    extern "C" to connected clients void PASCAL TSCast(LPCVOID pData, int nLen);

    // Send a message to the specified client

Guess you like

Origin blog.csdn.net/kaizi318/article/details/108908695