C# SAMP Query mechanism (Response packet) [Question]? -
Niko_boy - 29.06.2013
so first have any one of you tried this ?
https://sampwiki.blast.hk/wiki/Query_Mechanism/Csharp
i am working on a application, actually i am very beginner to C# i am learning it , i got everything working using thata api code.. but response from 'd' is kinda very fail
it stop fetching players info if total player are more than 29-30 or somewhere near value , i tried to break out loop from api when count more than certain number but it is still same..
so what actually happening is
int count = sQuery.Recieve(); returns 0 count when player count is more than 30 ( approx )
i tried multiple servers too.
though api work like charm and i get very good response from all other packets but 'd' is failing hard
can someone help me out ? i am quite struck at this point already tried 5 hours of work and got sick of it, firstly though listView is fialing but sooner i realised mistake i.e. this api failing
so please..!
Thanks in Advance
Re: C# SAMP Query mechanism (Response packet) [Question]? -
bartekdvd - 29.06.2013
In Query class:
Код:
public int Recieve()
{
try
{
_count = 0;
EndPoint endpoint = new IPEndPoint(address, _port);
byte[] rBuffer = new byte[500];
qSocket.ReceiveFrom(rBuffer, ref endpoint);
change this line:
byte[] rBuffer = new byte[500];
to
Код:
public int Recieve()
{
try
{
_count = 0;
EndPoint endpoint = new IPEndPoint(address, _port);
byte[] rBuffer = new byte[3402];
qSocket.ReceiveFrom(rBuffer, ref endpoint);
This should be also corrected on sa-mp.wiki too.
EDIT;
I don't know if it will work actually, but buffer with 500 bytes size is not enough to store more than 14 detailed player information with maximum name length - 24.
Re: C# SAMP Query mechanism (Response packet) [Question]? -
Niko_boy - 29.06.2013
oh well i will give it a try , didnt noticed cellsize anyways lol

thanks nice trying it now..!
EDIT: Omg man you are a life safer, this really did worked! it seem there is lag in retrieving many things together but still work like charm <3, thank you man thanks alot. respect.!
Re: C# SAMP Query mechanism (Response packet) [Question]? -
KingHual - 29.06.2013
Quote:
Originally Posted by bartekdvd
In Query class:
Код:
public int Recieve()
{
try
{
_count = 0;
EndPoint endpoint = new IPEndPoint(address, _port);
byte[] rBuffer = new byte[500];
qSocket.ReceiveFrom(rBuffer, ref endpoint);
change this line: byte[] rBuffer = new byte[500];
to
Код:
public int Recieve()
{
try
{
_count = 0;
EndPoint endpoint = new IPEndPoint(address, _port);
byte[] rBuffer = new byte[3402];
qSocket.ReceiveFrom(rBuffer, ref endpoint);
This should be also corrected on sa-mp.wiki.
EDIT;
I don't know if it will work actually, but buffer with 500 bytes size is not enough to store more than 14 detailed player information with maximum name length - 24.
|
Isn't a loop which stores 512 bytes of data into rBuffer a better idea? That way there would be virtually no limit.
Re: C# SAMP Query mechanism (Response packet) [Question]? -
bartekdvd - 29.06.2013
Quote:
Originally Posted by king_hual
Isn't a loop which stores 512 bytes of data into rBuffer a better idea? That way there would be virtually no limit.
|
Yeah it is if you want to save memory.
@down
Leave it like it is now I guess.
Re: C# SAMP Query mechanism (Response packet) [Question]? -
Niko_boy - 29.06.2013
so what you expect me to do now? i mean what i should do ?
it actually worked though but ye that will be quite a large size assigning