Raised This Month: $32 Target: $400
 8% 

SOCKET! Socket splits a packet into parts!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Skymotion
New Member
Join Date: Apr 2019
Location: Russia
Old 12-04-2020 , 16:36   SOCKET! Socket splits a packet into parts!
Reply With Quote #1

Hello!
Today I wanted to transfer a 6kb file from one server to the game server over a TCP connection.
As far as I know, the maximum packet size is 65535 bytes. This is more than enough to transfer this small file in one package.
I noticed that I am sending a complete packet, and socket splits it into parts by calling the receive function several times.
I read about SocketSetOption but I don't understand how to use it correctly because it leads nowhere.
Please tell me how you can disable the division of the package into parts!
I hope for your answer. Thanks in advance!
Skymotion is offline
Send a message via Skype™ to Skymotion
Kolapsicle
Senior Member
Join Date: Oct 2014
Old 12-06-2020 , 04:43   Re: SOCKET! Socket splits a packet into parts!
Reply With Quote #2

TCP packets are typically no larger than 1500 bytes before they're fragmented, but you can try to set the MSS like this:

PHP Code:
SocketSetOption(socketSocketSendBuffer6144); 
I'm not sure how the packet will be received since devices may expect <=1500 MTU. Maybe someone who knows more about this subject can chime in.

Last edited by Kolapsicle; 12-06-2020 at 04:44.
Kolapsicle is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 12-06-2020 , 05:07   Re: SOCKET! Socket splits a packet into parts!
Reply With Quote #3

TCP is a streaming protocol, the application protocol and receiving end need to deal with any size fragments and reconstructing the sent data (due to naggle you can even have multiple writes sent as a single packet).
__________________
asherkin is offline
Skymotion
New Member
Join Date: Apr 2019
Location: Russia
Old 12-12-2020 , 01:00   Re: SOCKET! Socket splits a packet into parts!
Reply With Quote #4

Thanks to Kolapsicle and asherkin for the answer. I realized what I needed to do.
Skymotion is offline
Send a message via Skype™ to Skymotion
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:01.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode