社区
C#
帖子详情
怎样确认TcpClient的联接已完成
jobs24
2003-08-28 03:29:26
在用 new TcpClient(host,port) 连接时,如果不用debug模式跟踪,停止一会,后面通过GetStream()返回的流读数据总是报错,未将对象引用到对象的实例;但一设断点跟踪就没事了。 请问怎样能确认连接过程已完成?
...全文
126
6
打赏
收藏
怎样确认TcpClient的联接已完成
在用 new TcpClient(host,port) 连接时,如果不用debug模式跟踪,停止一会,后面通过GetStream()返回的流读数据总是报错,未将对象引用到对象的实例;但一设断点跟踪就没事了。 请问怎样能确认连接过程已完成?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
mole
2003-09-12
打赏
举报
回复
把申明语句与connect分开写就可以了!
TcpClient Server = new TcpClient();
Server.Connect( "jobs", 110 );
NetworkStream NetStrm = Server.GetStream();
StreamReader RdStrm = new StreamReader( NetStrm );
storm97
2003-08-28
打赏
举报
回复
连接后加一个时间延迟,比如说等1秒以后再读数据。
jobs24
2003-08-28
打赏
举报
回复
TcpClient Server = new TcpClient( "jobs", 110 );
NetworkStream NetStrm = Server.GetStream();
StreamReader RdStrm = new StreamReader( NetStrm );
如果我再第一句话上设断点,执行到此时按一下F5,后面再读的所有数据都正常,否则就会出错。但第一句连接语句不会出错。
顾君彦
2003-08-28
打赏
举报
回复
try一下就可以了.
jobs24
2003-08-28
打赏
举报
回复
可是 C# 的 TcpClient没有这个Active这个属性
declude
2003-08-28
打赏
举报
回复
试试TcpClient.Active 属性。
杭电oj HDOJ 1013 Digital Roots
杭电oj HDOJ 1013 Digital Roots 题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1013 Problem Description The digital root of a positive integer is found by summing the digits of the integer. If the result...
HDOJ 1013 Digital Roots
Digital Roots Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 70304 Accepted Submission(s): 22012 Problem Description The digita
HDOJ1013 Digital Roots【常规解法+九余数定理】
HDOJ1013 题目 代码1:常规解法 #include<stdio.h> #include<string.h> int main() { char number[100000]; int sum, m, i, n; while(gets(number)) { sum = 0; for(i=0;i<strlen(number);i++...
HDOJ--1013Digital Roots
原题链接 Problem Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root.
HDOJ 1013 Digital Roots
【题意】找数根,所谓的数根用例子来说明。如果是24,则24相加,如果结果是单位数,则为数根。如果是39,相加得12,则再次相加得3为数根。 注意:题目没有说明整数范围,其实整数范围很大,至少1000位。 思路:用字符串存刚开始的数,然后将各位相加。后边用不到对字符串的处理,因为每一位最大为9,1000位不过9000,所以后边存在int里处理就行。 【代码:WA】 #include
C#
111,129
社区成员
642,541
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章