the thing is that my application works on LAN but it doesnt work through internet. When i use my local IP the connection is made but when I get my IP from whatsmyip.com and use it there are numerous problems...
here's the server:
// so. when i use IPAddress.Any it doesnt get through and when i use my ip i get error: The requested address is not valid in its context // and when i use my local ip (192.168.1.4) everything works fine... im out of ideas... |
and here's the "client":
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.Threading;
namespace SimpleChatClient
{
class Program
{
static void Main()
{
int trace = 0;
TcpClient client = new TcpClient();
// 93.139.3.97 192.168.1.4
IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse("93.139.3.97"), 15555);
Console.WriteLine(trace++);
client.Connect(IPAddress.Parse("93.139.3.97"), 15555);
Console.WriteLine(trace++);
NetworkStream clientStream = client.GetStream();
Console.WriteLine(trace++);
ASCIIEncoding encoder = new ASCIIEncoding();
byte[] buffer = encoder.GetBytes("Hello Server!");
Console.WriteLine(trace++);
clientStream.Write(buffer, 0, buffer.Length);
Console.WriteLine(trace++);
clientStream.Flush();
}
}
}
Dito DitoPosted Sep 7, 2010, 10:08 AM
your private ip will mapped to another ip which will be the public ip for internet zone.
you can check the both ips... it will be different. "
im sorry but i dont understand what you are saying.
are you saying that the ip i get from whatsmyip.com isnt the one to be used?
Dipal ChoksiPosted Sep 6, 2010, 5:38 PM
- are you sure you are using the correct external IP ?
- could a firewall/router be blocking any of your messages?
- try pinging the external address that wasn't going through - if there aren't any network/IP issues, you should be able to ping the IP address..
Hope this helps!
Suthish NairPosted Sep 6, 2010, 4:29 PM
your private ip will mapped to another ip which will be the public ip for internet zone.
you can check the both ips... it will be different.