establishing a TCP connection from an emulated device (Pocket PC)
I am trying to create a server application that, once started, a Pocket PC application can connect to to retrive data. I cant even get a connection established with the Pocket PC device. I am constantly getting the socket exception saying the host activly refused the connection. I am using the loop back adapter and have bound the NE2000 card to it. Host only networking is also enabled. I have also removed the firewall from the loopback adapter. My server code is as follows Imports
Imports
System.Net.SocketsImports
System.IOImports
System.TextDim
TransmitterAs TcpListenerDim ConnectionAs TcpClient
Dim ListenOnAsNew IPEndPoint(IPAddress.Parse("127.0.0.1"), 5000)
Dim ResponseAsString ="server response"
Transmitter =New TcpListener(ListenOn)Transmitter.Start()
Connection = Transmitter.AcceptTcpClient()
Dim ByteConversionArray()AsByteByteConversionArray = Encoding.ASCII.GetBytes(Response)
Connection.GetStream()
Connection.GetStream.Write(ByteConversionArray, 0, ByteConversionArray.Length)
Connection.Close()
The code on the device is as follows
Imports System.Net
Imports
System.Net.SocketsImports
System.IOImports
System.TextDim ClientAsNew TcpClient
Dim responseAsString
Dim remoteEPAsNew IPEndPoint(IPAddress.Parse("127.0.0.1"), 5000)
'Try
Client.Connect(remoteEP) ' the code fails here
'Catch sexp As SocketException
'End Try
Dim stream = Client.GetStream()
Dim InputBuffer(128)AsByte
Client.GetStream.Read(InputBuffer, 0, InputBuffer.Length)
response = Encoding.ASCII.GetString(InputBuffer, 0, InputBuffer.Length)
Client.Close()
TxtMessage.Text = response
If any one has any ideas I would appreciate it
Thanks
Jon

