我知道关于这个主题有许多线索,但我无法做到。我想通过互联网发送一封信或一个号码(不是本地!)。我已经尝试过Ipv6和Ip4,但两者都没有用。如果您可以使用C#或Java:c以下是一些代码示例:
//Server
Socket sock = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
sock.SetSocketOption(SocketOptionLevel.IPv6, (SocketOptionName)27, 0);
sock.Bind(new IPEndPoint(IPAddress.IPv6Any, 5005));
sock.Listen(4);
Socket client = sock.Accept();
Console.WriteLine("Works!");
Console.ReadKey();
//Client
string ip;
ip = Console.ReadLine();
IPAddress ipad = IPAddress.Parse(ip);
Socket sock = new Socket(AddressFamily.InterNetworkV6,
SocketType.Stream,
ProtocolType.Tcp);
Console.WriteLine("try to "+ipad,
ipad);
sock.Connect(ipad, 5005);
Console.WriteLine("yesssssss");
Console.ReadKey();