473,378 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Socket Problem

Ok - something for socket jockeys
I have a .NET application using the TcpClient class from System.Net.Sockets
I use this to connect to an IP address/Socket on the other side of Australia.

There is a problem though. The read from the socket returns 0 bytes which means the socket/host has closed down.
However using a telnet session, I know that this isn't the case. The telnet session sends data through Ok.
So what could be causing the problem:
Firewalls

Routers

Or something else

Note that the client can read fine from a host application located on my machine.

Jul 21 '05 #1
2 1371
Nick Zdunic <ni**@ss.com.au> wrote:
Ok - something for socket jockeys

I have a .NET application using the TcpClient class from
System.Net.Sockets

I use this to connect to an IP address/Socket on the other side of
Australia.

There is a problem though. The read from the socket returns 0 bytes
which means the socket/host has closed down.

However using a telnet session, I know that this isn't the case. The
telnet session sends data through Ok.
That doesn't mean that the socket hasn't been closed by the other side
though.
So what could be causing the problem:


I suggest you use a network monitor to find out what's going on. Do you
have control of the server app as well? If so, add some debug
information to see when it's closing the socket and why.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #2
Fixed the problem. The host I was connecting was not actually a host in the
strict sense - it was another client. I had two TcpClients connecting to
it - one which was sending messages and another that was reading. I have
modified the program to use the one connection for both sending and
receiving.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Nick Zdunic <ni**@ss.com.au> wrote:
Ok - something for socket jockeys

I have a .NET application using the TcpClient class from
System.Net.Sockets

I use this to connect to an IP address/Socket on the other side of
Australia.

There is a problem though. The read from the socket returns 0 bytes
which means the socket/host has closed down.

However using a telnet session, I know that this isn't the case. The
telnet session sends data through Ok.


That doesn't mean that the socket hasn't been closed by the other side
though.
So what could be causing the problem:


I suggest you use a network monitor to find out what's going on. Do you
have control of the server app as well? If so, add some debug
information to see when it's closing the socket and why.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Thomas Hervé | last post by:
My problem is not really python specific but as I do my implementation in python I hope someone here can help me. I have two programs that talk through a socket. Here is the code : <server>...
4
by: Bryan Olson | last post by:
Here's the problem: Suppose we use: import socket f = some_socket.makefile() Then: f.read() is efficient, but verbose, and incorrect (or at least does not play will with others);
4
by: faktujaa | last post by:
Hi, I am having some problem with callback used in socket implementation. private static void Connect(string strPrtrIPAddr, int intPrtrPort, ref Socket rsocClient) { try { // Create remote end...
4
by: zbcong | last post by:
Hello: I write a multithread c# socket server,it is a winform application,there is a richtextbox control and button,when the button is click,the server begin to listen the socket port,waiting for a...
4
by: Chris Tanger | last post by:
Context: C# System.Net.Sockets Socket created with constructor prarmeters Internetwork, Stream and TCP everything else is left at the default parameters and options except linger may be changed...
4
by: Sašo Zagoranski | last post by:
Hi! I'm writing a simple 3D First person shooter game. It is a multiplayer game, where all the players connect to one server.
11
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling...
6
by: ahlongxp | last post by:
socket.makefile() may lose data when "connection reset by peer". and socket.recv() will never lose the data. change the "1" to "0" in the client code to see the difference. confirmed on both...
0
by: george585 | last post by:
Hello! I am new to network programming, and understand just basics. Using some sample code, and having read documentation, I managed to create a simple app in C# and VB.NET. The application is...
16
by: =?iso-8859-1?q?|-|e|=5F|=5F_B0=DD?= | last post by:
hi all! I got a problem. I declared a SOCKET var in my C program but when i compiled the program it displayed like *--------------------------------------------------------------* *'SOCKET':...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.