0

Hi!

Im having a problem in the next line:

i = socket.Receive(buffer)

buffer is defined as: byte[] buffer = new byte[1024];

It crash when its waiting for the answer.

In c++ im sending this:

len = send(sock,"hola",4,0);

Any idea?

Thanks

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by krosty4782
0

Yeah, socket is well open beacuse first i tried to send a string, and the string go well.

getSocket(numsock).socketSend("filemanager"); --> this is ok, beacuse server recive the string.
 Console.WriteLine(getSocket(numsock).socketRecv()); --> I will put down the method code
public string socketRecv()
        {
             buffer = new byte[1024];
                        i = socket.Receive(buffer); --> Here crash 
                        string recibido = System.Text.Encoding.UTF8.GetString(buffer);
                        return recibido;

        }

Edited by krosty4782: n/a

0

Solved !!
I had a loop o "receive()" in other thread of other class xD

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.