Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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

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

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

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.

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

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 - https://docs.microsoft.com/en-us/windows/win32/api...
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close