这是服务器程序
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
namespace SeverConsole {
class Program {
static void Main(string[] args) {
Console.WriteLine("Sever is runing");
IPAddress ip = new IPAddress( new byte[]{127,0,0,1});
TcpListener tcpListener = new TcpListener(ip, 8500);
tcpListener.Start();
while (true) {
TcpClient remoteClient = tcpListener.AcceptTcpClient();
Console.WriteLine(@"有客户端连入,{0}<--{1}", remoteClient.Client.LocalEndPoint, remoteClient.Client.RemoteEndPoint);
}
Console.WriteLine(@"please press 'Q' to exit");
//Console.ReadLine();
ConsoleKey key;
do {
key = Console.ReadKey().Key;
} while (key != ConsoleKey.Q);
}
}
}
这是客户端程序
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;
namespace clientConsole {
class Program {
static void Main(string[] args) {
Console.WriteLine("Client is running!");
TcpClient client;
for (int i = 0; i < 4; i++) {
client = new TcpClient();
try {
client.Connect("....", 8500);
} catch (Exception ex) {
Console.WriteLine(ex.Message);
}
Console.WriteLine("connecting successful");
Console.WriteLine("{0}-->{1}", client.Client.LocalEndPoint, client.Client.RemoteEndPoint);
}
ConsoleKey key;
do {
key = Console.ReadKey().Key;
} while (key != ConsoleKey.Q);
}
}
}
客户端在连接的时候 老是异常
Not recognizing known sRGB profile that has been edited