Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximum buffer size on Winsock for sending one block of data over TCP / IP

Status
Not open for further replies.

CryptoTuke

Systems Engineer
Mar 2, 2022
1
0
0
SK
I am working on an application where clients who know the IP address of the server and the port number on which it listens connect to the server via TCP / IP. The server provides a chat room service, which means that clients can exchange data with each other. Communication is secured using a cryptographic protocol. This protocol encrypts the data and sends it still in one block send, wheither you send 5kB or 50MB. According to the source code, the protocol should be limited to uint32_t. I'm trying to test it, and when I send 1GB of data, the data is sent fine, but when I try to send data larger than 2 GB, it returns a large negative number and doesn't send. I know that they could be divided into smaller parts and sent sequentially, but the protocol encrypts and sends the data in one block, so I'm adapting.

I want to ask, is the Winsock send buffer limited by any size? If yes? And is it possible to increase the buffer according to your needs? I read some forums or articles, but I couldn't answer my questions specifically.
 
This is the best answer I have seen:

"The maximum message packet size for a provider can be obtained by calling getsockopt with the optname parameter set to SO_MAX_MSG_SIZE to retrieve the value of socket option."

From here - My thinking is the buffer is set from the network adaptor and winsock is just a means of letting a protocol talk to each end of the connection.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top