danielga / sourcequery

A Source engine (VALVe) and respective masterservers querying library.
https://github.com/danielga/sourcequery
1 stars 0 forks source link

Sometimes getserverlist never get 0.0.0.0 ip, but recbuffer still have info about new servers. #1

Open afwn90cj93201nixr2e1re opened 5 years ago

afwn90cj93201nixr2e1re commented 5 years ago

stuck here

https://github.com/danielga/sourcequery/blob/development/source/sourcequery/masterquery.cpp#L290

but here https://github.com/danielga/sourcequery/blob/development/source/sourcequery/masterquery.cpp#L289 recv fill up recv_buffer.

then https://github.com/danielga/sourcequery/blob/development/source/sourcequery/masterquery.cpp#L304 never called.

End of IP address list The full requested IP list may not fit in 1 x packet. Subsequent packets must be requested by using the last received IP address and Port as the 'seed' in the next request. The end of the IP list is indicated by a received IP address of 0.0.0.0 Port:0.

https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol#Reply_format

afwn90cj93201nixr2e1re commented 5 years ago

@danielga

danielga commented 5 years ago

I see, if the UDP packets go out of order or something else is received, the whole process is stopped.

afwn90cj93201nixr2e1re commented 5 years ago

So, how we can fix it? i think there no problems with order, coz every time we send last_address and if address is rly last, then we should get 0.0.0.0, sometimes it's happens, but, it's rarely.

afwn90cj93201nixr2e1re commented 5 years ago

I mean maybe we should use vector size instead prefering byteslength=recv?

https://stackoverflow.com/questions/53001843/c-recv-occasionally-returns-extremely-large-number

https://stackoverflow.com/questions/22106160/c-winsock-recv-returns-incorrect-and-strange-buffer

@danielga

afwn90cj93201nixr2e1re commented 5 years ago

Im using it in another thread. bytes_received = -1 | realsize = 1500 10060|A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

getting this error first thread https://pastebin.com/aUL4rJuJ

second thread https://pastebin.com/NKuG6K27

but timeout 10000ms.

afwn90cj93201nixr2e1re commented 5 years ago

Maybe we should make it more better? For example read buffer without parsing or smthng like that? while(recv... & ip != 0)send... send(end of connection) wait... read all server's to buffer.