2 tabe123 tabe123 于 2015.07.09 22:08 提问

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

2个回答

weixin_29617471
weixin_29617471   2015.07.09 22:35

这个错误应该是安卓编译器的问题,可以不用理会

tabe123
tabe123 这个是.net,而且出现这个错误 两个主机根本无法连接,数据也传输不了
2 年多之前 回复
caozhy
caozhy   Ds   Rxr 2015.07.09 22:53
tabe123
tabe123 啊 我没有用图片啊,就是尝试了连接一下,结果连不上
2 年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片