问题描述
- c#客户端程序连不上其他服务器程序
-
这是服务器程序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
解决方案
这个错误应该是安卓编译器的问题,可以不用理会
解决方案二:
http://power.baidu.com/question/625140751274441244.html?entry=qb_browse_default
图片格式不标准。