473,409 Members | 1,954 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,409 software developers and data experts.

C# Reflection - Nasty bug??

In specific (repeatable) cases the client fails to connect to the server
running on the same machine. The client receives the
System.Net.Sockets.SocketException: "A socket operation was attempted to an
unreachable host" although the server is still running and listening on the
right port (45326 my case).

This happens when LAN (or internet) connection is present upon starting the
server and then desactivated (cable is removed). After LAN is no accessible,
the client cannot connect to the server anymore (note that they are on the
same machine!). When the cable is reinserted, the connection works again!

On the other side if server is started when LAN is not present, it will work
no matter what.

I put more details here:

http://www.david13.com/cases/DotNet/...Local-Machine/

I would kindly ask you to check it and help me with advice so we can confirm
a bug or find a solution together. Thank you very much!

David Krmpotic
http://www.david13.com
Nov 17 '05 #1
7 2381
See if it does it with two machines, one the server and the other the
client.

Nov 17 '05 #2
hmm I cannot do that.
I cannot connect to the machine with the server if the cable is unplugged..

"stork" <tb******@mightyware.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
See if it does it with two machines, one the server and the other the
client.

Nov 17 '05 #3
I have seen this similar problem but with other network based apps (not
necessarily remoting), is it possible for you to indicate that all
connections in your program must go to localhost or 127.0.0.1? That will
force all packets to go through the internal network loop.

Also it has also occurred to me for you to check your firewall settings on
the local computer and make sure the port is allowed, even if it is in the
same machine the firewall can block packets going into that port.

"David Krmpotic" <da************@no-no.si> wrote in message
news:UH********************@news.siol.net...
In specific (repeatable) cases the client fails to connect to the server
running on the same machine. The client receives the
System.Net.Sockets.SocketException: "A socket operation was attempted to
an
unreachable host" although the server is still running and listening on
the
right port (45326 my case).

This happens when LAN (or internet) connection is present upon starting
the
server and then desactivated (cable is removed). After LAN is no
accessible,
the client cannot connect to the server anymore (note that they are on the
same machine!). When the cable is reinserted, the connection works again!

On the other side if server is started when LAN is not present, it will
work
no matter what.

I put more details here:

http://www.david13.com/cases/DotNet/...Local-Machine/

I would kindly ask you to check it and help me with advice so we can
confirm
a bug or find a solution together. Thank you very much!

David Krmpotic
http://www.david13.com

Nov 17 '05 #4
Thank you Alex.
I don't have a firewall on the affected machine. What do you mean exactly by
"is it possible for you to indicate that all connections in your program
must go to localhost or 127.0.0.1"? I don't quite understand it. Of course I
know what is 127.0.0.1 and localhost, but I still don't know what are you
asking. Could you clarify? Thank you.
"Alex Passos" <bz@netmerlin.nospam.com> wrote in message
news:uv**************@TK2MSFTNGP12.phx.gbl...
I have seen this similar problem but with other network based apps (not
necessarily remoting), is it possible for you to indicate that all
connections in your program must go to localhost or 127.0.0.1? That will
force all packets to go through the internal network loop.

Also it has also occurred to me for you to check your firewall settings on
the local computer and make sure the port is allowed, even if it is in the
same machine the firewall can block packets going into that port.

"David Krmpotic" <da************@no-no.si> wrote in message
news:UH********************@news.siol.net...
In specific (repeatable) cases the client fails to connect to the server
running on the same machine. The client receives the
System.Net.Sockets.SocketException: "A socket operation was attempted to
an
unreachable host" although the server is still running and listening on
the
right port (45326 my case).

This happens when LAN (or internet) connection is present upon starting
the
server and then desactivated (cable is removed). After LAN is no
accessible,
the client cannot connect to the server anymore (note that they are on the same machine!). When the cable is reinserted, the connection works again!
On the other side if server is started when LAN is not present, it will
work
no matter what.

I put more details here:

http://www.david13.com/cases/DotNet/...Local-Machine/
I would kindly ask you to check it and help me with advice so we can
confirm
a bug or find a solution together. Thank you very much!

David Krmpotic
http://www.david13.com


Nov 17 '05 #5
Can you telnet into localhost to the port your server is running and get
some kind of a prompt instead of "Connection cannot be established?" like

dos prompt> telnet localhost 12345

12345 is port number, I don't remember exactly which port you were using so
drop your port number in place of 12345. If you don't get a prompt your
server is:

1) Not accepting connections
2) Being blocked

Thats where I would start.

"David Krmpotic" <da************@no-no.si> wrote in message
news:3a********************@news.siol.net...
Thank you Alex.
I don't have a firewall on the affected machine. What do you mean exactly
by
"is it possible for you to indicate that all connections in your program
must go to localhost or 127.0.0.1"? I don't quite understand it. Of course
I
know what is 127.0.0.1 and localhost, but I still don't know what are you
asking. Could you clarify? Thank you.
"Alex Passos" <bz@netmerlin.nospam.com> wrote in message
news:uv**************@TK2MSFTNGP12.phx.gbl...
I have seen this similar problem but with other network based apps (not
necessarily remoting), is it possible for you to indicate that all
connections in your program must go to localhost or 127.0.0.1? That will
force all packets to go through the internal network loop.

Also it has also occurred to me for you to check your firewall settings
on
the local computer and make sure the port is allowed, even if it is in
the
same machine the firewall can block packets going into that port.

"David Krmpotic" <da************@no-no.si> wrote in message
news:UH********************@news.siol.net...
> In specific (repeatable) cases the client fails to connect to the
> server
> running on the same machine. The client receives the
> System.Net.Sockets.SocketException: "A socket operation was attempted
> to
> an
> unreachable host" although the server is still running and listening on
> the
> right port (45326 my case).
>
> This happens when LAN (or internet) connection is present upon starting
> the
> server and then desactivated (cable is removed). After LAN is no
> accessible,
> the client cannot connect to the server anymore (note that they are on the > same machine!). When the cable is reinserted, the connection works again! >
> On the other side if server is started when LAN is not present, it will
> work
> no matter what.
>
> I put more details here:
>
> http://www.david13.com/cases/DotNet/...Local-Machine/ >
> I would kindly ask you to check it and help me with advice so we can
> confirm
> a bug or find a solution together. Thank you very much!
>
> David Krmpotic
> http://www.david13.com
>
>



Nov 17 '05 #6
Ok so after the bug manifests what you have is this:

1) You can verify the server portion is running because when you telnet into
it you are getting a prompt
2) You know that it has nothing to do with the network because you have
tried on the localhost interface without going through the actual card.

So by process of elimination here are some of my thoughts:

1) You client cannot connect to the server because the server portion is in
an inconsistent state. I.E. might be listening for connections but not
accepting (sounds far fetched but I have just about seen it all).

2) The client portion is not connecting to the right host. This could be a
DNS resolution issue as well that might be happening on your box especially
if the server is binding to "localhost" and the client is actually looking
for a hostname, make sure the hostname of the client maps to localhost in
DNS.

Do you have the code for the server as well? Maybe you ought to set break
points on the server and client simultaneously and simular the entire
connection process to see where its failing.

Alex

"David Krmpotic" <da************@no-no.si> wrote in message
news:TB********************@news.siol.net...
Alex,

oh, ok.. thank you!

So I did it and I discovered two things.. After the problem happens, I
can
still get the prompt although I cannot connect to the server with my
client.

The second thing I discovered is that the same thing happens if I use the
WLAN connection and then take out the card. It is not just the ethernet.

What step would you suggest next? Many thanks!

David

"Alex Passos" <bz@netmerlin.nospam.com> wrote in message
news:ug*************@TK2MSFTNGP10.phx.gbl...
Can you telnet into localhost to the port your server is running and get
some kind of a prompt instead of "Connection cannot be established?" like

dos prompt> telnet localhost 12345

12345 is port number, I don't remember exactly which port you were using

so
drop your port number in place of 12345. If you don't get a prompt your
server is:

1) Not accepting connections
2) Being blocked

Thats where I would start.

"David Krmpotic" <da************@no-no.si> wrote in message
news:3a********************@news.siol.net...
> Thank you Alex.
> I don't have a firewall on the affected machine. What do you mean exactly > by
> "is it possible for you to indicate that all connections in your
> program
> must go to localhost or 127.0.0.1"? I don't quite understand it. Of course > I
> know what is 127.0.0.1 and localhost, but I still don't know what are you > asking. Could you clarify? Thank you.
>
>
> "Alex Passos" <bz@netmerlin.nospam.com> wrote in message
> news:uv**************@TK2MSFTNGP12.phx.gbl...
>> I have seen this similar problem but with other network based apps
>> (not
>> necessarily remoting), is it possible for you to indicate that all
>> connections in your program must go to localhost or 127.0.0.1? That will >> force all packets to go through the internal network loop.
>>
>> Also it has also occurred to me for you to check your firewall
>> settings
>> on
>> the local computer and make sure the port is allowed, even if it is in
>> the
>> same machine the firewall can block packets going into that port.
>>
>> "David Krmpotic" <da************@no-no.si> wrote in message
>> news:UH********************@news.siol.net...
>> > In specific (repeatable) cases the client fails to connect to the
>> > server
>> > running on the same machine. The client receives the
>> > System.Net.Sockets.SocketException: "A socket operation was
>> > attempted
>> > to
>> > an
>> > unreachable host" although the server is still running and listening on >> > the
>> > right port (45326 my case).
>> >
>> > This happens when LAN (or internet) connection is present upon starting >> > the
>> > server and then desactivated (cable is removed). After LAN is no
>> > accessible,
>> > the client cannot connect to the server anymore (note that they are on > the
>> > same machine!). When the cable is reinserted, the connection works
> again!
>> >
>> > On the other side if server is started when LAN is not present, it will >> > work
>> > no matter what.
>> >
>> > I put more details here:
>> >
>> >
> http://www.david13.com/cases/DotNet/...Local-Machine/ >> >
>> > I would kindly ask you to check it and help me with advice so we can
>> > confirm
>> > a bug or find a solution together. Thank you very much!
>> >
>> > David Krmpotic
>> > http://www.david13.com
>> >
>> >
>>
>>
>
>



Nov 17 '05 #7
Thank you very much.. I will try to do it.. Please delete the numbers 432
below.

It happened on anothe machine.. so it is definitelly not the problem just
with my machine!

Oh I just remembered something important.. Very important..
I am not connecting to the server through localhost, but with computer name.
.... oh nevermind.. now I tried with localhost and 127.0.0.1 and it is the
same..
hmm too bad.. so it definitelly isn't supposed to be like that..

I have some other priorites and don't have time to play with it.

I hope somebody from microsoft could try it.. so if nothing else, they could
fix it for .NET 2.0, if they didn't yet.

Well.. thank you for your help.. and if I fix something soon, I'll post
here.. if, however somebody else does it, I would appreciate if they let me
know about it on:
da*******@easy.com

thank you!

"Alex Passos" <bz@netmerlin.nospam.com> wrote in message
news:Oq**************@TK2MSFTNGP12.phx.gbl...
Ok so after the bug manifests what you have is this:

1) You can verify the server portion is running because when you telnet into it you are getting a prompt
2) You know that it has nothing to do with the network because you have
tried on the localhost interface without going through the actual card.

So by process of elimination here are some of my thoughts:

1) You client cannot connect to the server because the server portion is in an inconsistent state. I.E. might be listening for connections but not
accepting (sounds far fetched but I have just about seen it all).

2) The client portion is not connecting to the right host. This could be a DNS resolution issue as well that might be happening on your box especially if the server is binding to "localhost" and the client is actually looking
for a hostname, make sure the hostname of the client maps to localhost in
DNS.

Do you have the code for the server as well? Maybe you ought to set break
points on the server and client simultaneously and simular the entire
connection process to see where its failing.

Alex

"David Krmpotic" <da************@no-no.si> wrote in message
news:TB********************@news.siol.net...
Alex,

oh, ok.. thank you!

So I did it and I discovered two things.. After the problem happens, I
can
still get the prompt although I cannot connect to the server with my
client.

The second thing I discovered is that the same thing happens if I use the WLAN connection and then take out the card. It is not just the ethernet.

What step would you suggest next? Many thanks!

David

"Alex Passos" <bz@netmerlin.nospam.com> wrote in message
news:ug*************@TK2MSFTNGP10.phx.gbl...
Can you telnet into localhost to the port your server is running and get some kind of a prompt instead of "Connection cannot be established?" like
dos prompt> telnet localhost 12345

12345 is port number, I don't remember exactly which port you were using
so
drop your port number in place of 12345. If you don't get a prompt
your server is:

1) Not accepting connections
2) Being blocked

Thats where I would start.

"David Krmpotic" <da************@no-no.si> wrote in message
news:3a********************@news.siol.net...
> Thank you Alex.
> I don't have a firewall on the affected machine. What do you mean

exactly
> by
> "is it possible for you to indicate that all connections in your
> program
> must go to localhost or 127.0.0.1"? I don't quite understand it. Of

course
> I
> know what is 127.0.0.1 and localhost, but I still don't know what are

you
> asking. Could you clarify? Thank you.
>
>
> "Alex Passos" <bz@netmerlin.nospam.com> wrote in message
> news:uv**************@TK2MSFTNGP12.phx.gbl...
>> I have seen this similar problem but with other network based apps >> (not
>> necessarily remoting), is it possible for you to indicate that all
>> connections in your program must go to localhost or 127.0.0.1? That

will
>> force all packets to go through the internal network loop.
>>
>> Also it has also occurred to me for you to check your firewall
>> settings
>> on
>> the local computer and make sure the port is allowed, even if it is in >> the
>> same machine the firewall can block packets going into that port.
>>
>> "David Krmpotic" <da************@no-no.si> wrote in message
>> news:UH********************@news.siol.net...
>> > In specific (repeatable) cases the client fails to connect to the
>> > server
>> > running on the same machine. The client receives the
>> > System.Net.Sockets.SocketException: "A socket operation was
>> > attempted
>> > to
>> > an
>> > unreachable host" although the server is still running and listening on
>> > the
>> > right port (45326 my case).
>> >
>> > This happens when LAN (or internet) connection is present upon

starting
>> > the
>> > server and then desactivated (cable is removed). After LAN is no
>> > accessible,
>> > the client cannot connect to the server anymore (note that they
are on
> the
>> > same machine!). When the cable is reinserted, the connection works
> again!
>> >
>> > On the other side if server is started when LAN is not present, it

will
>> > work
>> > no matter what.
>> >
>> > I put more details here:
>> >
>> >
>

http://www.david13.com/cases/DotNet/...Local-Machine/ >> >
>> > I would kindly ask you to check it and help me with advice so we can >> > confirm
>> > a bug or find a solution together. Thank you very much!
>> >
>> > David Krmpotic
>> > http://www.david13.com
>> >
>> >
>>
>>
>
>



Nov 17 '05 #8

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

Similar topics

0
by: A. Wiebenga | last post by:
Hi all! I am a student at the Hogeschool van Arnhem en Nijmegen in Holland. I am currently involved in a research project regarding Reflection. Purpose of the research project is to document...
2
by: danny van elsen | last post by:
hello all, in my application, I want to save the state of a number of classes to disk: what would be the best way to do this? right now, I'm hard coding the fields of the classes, but of course...
10
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a...
0
by: Iain | last post by:
I'm building a system which prints out a word document based on a word template and reflection. it's easy enough to do is specific cases using reflection - when you pass in an object and are...
0
by: Shawn Hogan | last post by:
Hi everyone, I've been trying to execute a control's private event code via reflection from another class with the goal of potentially doing some unit testing. The examples below are trying to...
4
by: CJ | last post by:
Hi I'm trying to send email via a c# app, and I've come across various ways to do it, but the way that seems best given my constraints is this little vbscript: Dim theApp, theNameSpace,...
1
by: Chad Dollins | last post by:
I've got everything going nearly except one line of code. I think I'm in over my head here so, I'm going to ask for some help. Basically what the preposal is that you will be able to open a...
9
by: Kuberan Naganathan | last post by:
Hello all Does anyone know of a good way to use reflection in c++? I don't mean simply using rtti or dynamic casting. I'm talking about java/c# style reflection where an actual instance of...
17
by: raylopez99 | last post by:
What good is C# Reflection, other than to find out what types are in an assembly? And to dynamically invoke methods in an assembly (.dll or .exe)? Also, bonus question, can you use Reflection...
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.