c#客户端程序连不上其他服务器程序

问题描述

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
图片格式不标准。

时间: 2024-07-28 20:30:46

c#客户端程序连不上其他服务器程序的相关文章

用Java实现多线程服务器程序

---- 摘要:在Java出现之前,编写多线程程序是一件烦琐且伴随许多不安全因素的事情.利用Java,编写安全高效的多线程程序变得简单,而且利用多线程和Java的网络包我们可以方便的实现多线程服务器程序. ---- Java是伴随Internet的大潮产生的,对网络及多线程具有内在的支持,具有网络时代编程语言的一切特点.从Java的当前应用看,Java主要用于在Internet或局域网上的网络编程,而且将Java作为主流的网络编程语言的趋势愈来愈明显.实际工作中,我们除了使用商品化的服务器软件外

《UNIX网络编程 卷1:套接字联网API(第3版)》——1.5 一个简单的时间获取服务器程序

1.5 一个简单的时间获取服务器程序 我们可以编写一个简单的TCP时间获取服务器程序,它和1.2节中的客户程序一道工作.图1-9给出了这个服务器程序,它使用了上一节中讲过的包裹函数. 创建TCP套接字10 TCP套接字的创建与客户程序相同. 把服务器的众所周知端口捆绑到套接字11~15 通过填写一个网际套接字地址结构并调用bind函数,服务器的众所周知端口(对于时间获取服务是13)被捆绑到所创建的套接字.我们指定IP地址为INADDR_ANY,这样要是服务器主机有多个网络接口,服务器进程就可以在

tpinit报错,没有安装tuxedo的机器上客户端程序如何去连接tuxedo服务器呢???

问题描述 在已经安装了tuxedo8.1的机器上运行客户端程序,完全正确,vc编写的客户端程序直接去连接tuxedo服务器,可在没有安装tuxedo的机器上客户端程序tpinit就要报错,tperrorno=8.我已经拷贝了libwsc.dll,wtuxws32.dll等DLL.分数有限,会贡献出来所有积分,望高手不吝赐教! 解决方案 本帖最后由 hobaobao 于 2012-01-29 15:52:32 编辑解决方案二:怎么没人回复啊?解决方案三:各位大哥,应该有人遇到过这种情况啊,怎么都没

求助,应用启动出现黑屏闪退,程序上、手机上或服务器上可能会有什么原因?

问题描述 求助,应用启动出现黑屏闪退,程序上.手机上或服务器上可能会有什么原因? 如题,应用启动出现黑屏闪退,程序上.手机上或服务器上可能会有什么原因?有遇到过的朋友么,求告知 解决方案 一般是你的客户端丢出了没有处理的异常造成的,也可能是你的程序使用了太多的内存.具体你要加上日志输出下.

客户端与服务器-C#客户端为什么连接不上服务器,当ip地址为127.0.0.1是没有问题的

问题描述 C#客户端为什么连接不上服务器,当ip地址为127.0.0.1是没有问题的 就是自己的电脑是连接路由器的,但是ip不是192.168.开头的,不知道是公网问题还是什么问题,测试都是用自己的一台电脑的. 解决方案 服务端Server using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using Syste

编写Socket客户端和服务器程序,客户端读取本地文件的数据,发送到服务器,服务器接收并存储到文件中。

问题描述 2.编写Socket客户端和服务器程序,客户端读取本地文件的数据,发送到服务器,服务器接收并存储到文件中.消息格式:字段长度(单位字节)内容--------------------------------------------------------------------len8整个消息长度,不包括这4个字节,类型为longfile_name_length1文件名长度,bytefile_namefile_name_length文件名,Stringdata_length8文件数据长度

Udp的服务器程序和客户端程序

//服务器程序: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> #define PORT 8082 #define BUFSIZE 512 char buf[BUFSIZE+

ftp-java web做的网站上线,已经把域名解析到服务器IP上,把程序上传到FTP中,但是网站打不开

问题描述 java web做的网站上线,已经把域名解析到服务器IP上,把程序上传到FTP中,但是网站打不开 前几天也问过这个问题,但是问题依旧,下面是tomcat日志报的错,大神看看这是什么问题 2015-6-19 9:43:18 org.apache.catalina.core.StandardContext filterStart 严重: Exception starting filter structs2 java.lang.UnsupportedClassVersionError: co

MFC做的socket连接的TCP聊天程序,客户端总是连接不上服务器端,上午还好好的,

问题描述 MFC做的socket连接的TCP聊天程序,客户端总是连接不上服务器端,上午还好好的, MFC做的socket连接的TCP聊天程序,客户端总是连接不上服务器端,上午还好好的,下午就一直连接不上,总是怀疑是电脑或者是VC的问题,因为有时候重新装下VC,程序就又好了,请问有懂的吗?这到底是哪里的问题>?用的VC6.0 解决方案 先看端口是否侦听 客户端连接的具体错误信息