I have a socket, I'm trying to send information from the client to the server. Both are located on the same network, with different LAN IP's (as follows):
My server is my C# application. - 192.168.0.2 My client is my Android application. - 192.168.0.7
Here's my TcpListener
for the server:
server = new TcpListener(IPAddress.Parse("192.168.0.7"), 7079);
Here's my connection on the client:
Socket conn = new Socket("192.168.0.2", 7079);
Firstly, I wasn't sure what to put as the TcpListener
IP. Obviously what I have is wrong, because it throws a SocketException
: The requested address is not valid in its context
.
EDIT:
First problem is resolved, I ran using emulator and put 10.0.2.2
for the connection IP. Now, C# is throwing an exception. Here's the surrounding code:
full code removed to prevent leaching
On the line beginning with while
, I get an ObjectDisposedException
saying that the NetworkStream is disposed. Any help?