Plz帮助我在Tcp聊天应用程序中出错 [英] Plz Help I M Getting A Error In Tcp Chat Application

查看:104
本文介绍了Plz帮助我在Tcp聊天应用程序中出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即将收到错误System.dll中出现类型'System.Net.Sockets.SocketException'的异常但未在用户代码中处理附加信息:尝试对无法访问的网络执行套接字操作

on

this.client = new TcpClient(+ this.myip,this.myport);

i m getting error "An exception of type 'System.Net.Sockets.SocketException' occurred in System.dll but was not handled in user code Additional information: A socket operation was attempted to an unreachable network"
on
this.client = new TcpClient(""+this.myip, this.myport);

推荐答案

构造函数你正在使用那里期待一个主机名和一个端口。看起来您正在尝试使用IP地址作为主机名。



试试这个(假设myip是IPAddress类型):



The constructor you are using there is expecting a hostname and a port. It looks like you are trying to use an IP address as the hostname.

Try this (presuming myip is of type IPAddress):

new TcpClient(new IPEndPoint(this.myip, this.myport));


这篇关于Plz帮助我在Tcp聊天应用程序中出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆