UdpClient.Send() through Router

A

aboni

Hi!

I'm developing a Client/Server using System.Net.Sockets.UdpClient.
My server app is running in a Windows XP Pro and Works Well.
My client app is running in a iPaq with Windows Mobile 5.0, and works well
when in the same network that my server.
The problem is that when I put a router between my server and my client, the
last can't send messages.

My first idea to solve the problem be modify the TTL of socket to 2, but I'm
don't do it.

I try with this two codes above below:

1 -
UdpClient udp = new UdpClient();
udp.Connect(new IPEndPoint(IPAddress.Parse("192.168.0.8"), 8000));
udp.Client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.IpTimeToLive, 2);
udp.Send(Encoding.ASCII.GetBytes("Mobile"), 6);

2 -
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,
ProtocolType.Udp);
IPAddress broadcast = IPAddress.Parse("192.168.0.8");
byte[] sendbuf = Encoding.ASCII.GetBytes("Mobile New");
IPEndPoint ep = new IPEndPoint(broadcast, 8000);
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.IpTimeToLive,
100);
s.SendTo(sendbuf, ep);

The line "udp.Client.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.IpTimeToLive, 2);" does not have any effect.

Anybody know if is really the TTL the problem to communicate through Router.
Observetion: the Router model is ZWA-G120.

Thanks for any,
aboni
(e-mail address removed)
 
G

Guest

The router needs to support port forwarding so packets will be forwarded onto
your server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top