Thread: Cached C#
View Single Post
Old 07.11.2007, 22:00   #10
wendigo
Guest
 
Posts: n/a
Default Cached C#

ima be a good boy..

this is a working code.

private int SendPacket(string ipserver,Packer pakete)

{

try

{

System.Net.Sockets.TcpClient supersocket = new System.Net.Sockets.TcpClient();

supersocket.Connect (ipserver,2012);

//si no pega excepcion abrimos el stream de escritura...

NetworkStream sstream = supersocket.GetStream();

byte[] sourceArray = pakete.ToArray();

int num = sourceArray.Length - 1;

byte[] destinationArray = new byte[num + 3];

destinationArray[0] = (byte)(num & 0xff);

destinationArray[1] = (byte)((num & 0xff00) >> Cool;

Array.Copy(sourceArray, 0, destinationArray, 2, sourceArray.Length);

sstream.Write(destinationArray, 0, destinationArray.Length);

supersocket.Close();

sstream.Flush();

return(0);

}

catch (SocketException se)

{

//algo anormal ha ocurrido y se ha lanzado una excepcion del socket.

return (2);//error.

}

}

public int CheckCharStatus(string ipserver, int charid)

{

Packer paketito=new Packer ((byte) 1);

paketito.AddInt32(4);

//0 char offline, 1 char online, 2 error.

return (SendPacket(ipserver,paketito));

}

hope this helps to u.

GMan obviously i found what i was doing wrong, now its working...thanks anyway...

btw i made this functions to help this guy, obviously it doesnt reads the answer from server blah blah blah xd

Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. В снимке указана только дата, без времени: 8 November 2007. Открыть источник.