Jump to content

Option for TCPRecv?

Recommended Posts



I have made one of my games so that it can be played multiplayer over a TCP connection, but it seems like TCPRecv() takes too much time, and creates an unwanted delay. I searched around in the forums, and all I found someone with the same problem, but I can't get their solution to work. Anyone knows a faster option than TCPRecv()?

This is what they came up with:

Func _TCPRecv($iSock, $iLen)
Local $structBuffer = DllStructCreate("char[" & $iLen & "]")
Local $aRet = DllCall("Ws2_32.dll", "int", "recv", "int", $iSock, "ptr", DllStructGetPtr($structBuffer), "int", $iLen, "int", 0)
If @error Then SetError(1, 0, "")
Return SetError(0, $aRet[0], DllStructGetData($structBuffer, 1))

Share this post

Link to post
Share on other sites

if string send is short. You can use UDP :) UDP Faster than TCP but just for small string.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.