Jump to content
Sign in to follow this  
Deathtorn

tcprecv error handling

Recommended Posts

Deathtorn

I'm getting an @error return of  -1 when using tcprecv() and im not sure what i need to do to figure out what that means, and how i can fix it. Any help would be appreciated,

Share this post


Link to post
Share on other sites
bogQ

What func do:Receives data from a connected socket

Success: the binary/string sent by the connected socket.

If it doesnt recive anything what will happend?

Failure: "" and sets the @error flag to non-zero.

@error: -1 Socket error

windows API WSAGetError return value (see MSDN).

So -1 is set when no msg is recived from client.

If @error = -1 Then Sleep(100);and-or ContinueLoop

If @error And @error <> -1 Then

; problem with TCPRecv communication, disconnect client!

EndIf

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
bogQ

No,

If @error And @error <> -1 Then

is for "if there is WSAGetError" to delite errored socked from list if needed or what ever

-1 error code isnt on WSAGetError list but instead its in autoit list i guess, think that WSAGetError to get last error in that case whud return 0

so

If @error = -1 Then

is to check if something is recived or not, if nothing is recived that dont necessarily mean you need to dcc client. Your choice if you need it at all or to just put this instead

If $Rec Then

Indicating to do something if something is recived (or nothing if nothing is recived)

Im wondering if maybe "If @error = -1" checking can be faster than compering if string is emptu or not.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

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
Sign in to follow this  

×