Z
zainab
Hello;
I'm having some problems connecting two devices (a laptop and a pda)
via ad-hoc using TCP. What disturbs me more is that the same code works
if i use it in the same computer (via localhost). The client always
thinks he's connecting to the server and the server never assumes to be
connected to any client (just keeps waiting).
Here are both codes:
SERVER:
IPEndPoint localEndPoint=new IPEndPoint("192.168.0.20", 8001);
Socket newsock=new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.TCP);
newsock.Bind(localEndPoint);
newsock.Listen(200);
Socket s=newsock.Accept(); // keeps waiting here
<rest of code>
also tried:
TcpListener myListener=new TcpListener(IPAddress.Parse("192.168.0.20",
8001);
myListener.Start();
Socket s=myListener.AcceptSocket(); // waits here
CLIENT:
TcpClient tcpclnt = new TcpClient();
tcpclnt.Connect("192.168.0.20", 8001); // jumps this code as if
connected, no notice on server
<rest of code>
the client's ip is 192.168.1.20. they work under UDP, but i can't get
them to work on TCP.
HELP!
tks
I'm having some problems connecting two devices (a laptop and a pda)
via ad-hoc using TCP. What disturbs me more is that the same code works
if i use it in the same computer (via localhost). The client always
thinks he's connecting to the server and the server never assumes to be
connected to any client (just keeps waiting).
Here are both codes:
SERVER:
IPEndPoint localEndPoint=new IPEndPoint("192.168.0.20", 8001);
Socket newsock=new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.TCP);
newsock.Bind(localEndPoint);
newsock.Listen(200);
Socket s=newsock.Accept(); // keeps waiting here
<rest of code>
also tried:
TcpListener myListener=new TcpListener(IPAddress.Parse("192.168.0.20",
8001);
myListener.Start();
Socket s=myListener.AcceptSocket(); // waits here
CLIENT:
TcpClient tcpclnt = new TcpClient();
tcpclnt.Connect("192.168.0.20", 8001); // jumps this code as if
connected, no notice on server
<rest of code>
the client's ip is 192.168.1.20. they work under UDP, but i can't get
them to work on TCP.
HELP!
tks