TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
neda khooyriz
NA
5
5.3k
error of reading data in socket programming
Apr 13 2014 2:36 AM
i wrote a console application. i used socket programming . i get error in below cod. transfer speed of data is 10ms . after a period of time i get a error on " while ((i = stream.Read(bytes, 0, bytes.Length)) != 0)" line .
while
(
true
) {
TcpClient
tcpClient = tcpListener.
AcceptTcpClient
();
NetworkStream
stream = tcpClient.
GetStream
();
String
data =
null
;
int
i;
while
((i = stream.
Read
(bytes,
0
, bytes.
Length
)) !=
0
) {
// Translate data bytes to a ASCII string.
data =
System
.
Text
.
Encoding
.ASCII.
GetString
(bytes,
0
, i);
Console
.
WriteLine
(
"Received: {0}"
, data); ... }
error:
An unhandled exception of type 'System.IO.IOException' occurred in System.dll Additional information: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Reply
Answers (
2
)
C# program to reverse each word of a sentence separately?
C# Filepath problem.Hello so i am starting a process