By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

Service not working in Network?

P: n/a
hi all,

I have written a C# Service which is a Server accepting Clients,It is
working fine when i connect from localhost but when i connect from any other
machine to my machine , the service is not working, the Service is in
"Network Service".....i even tried "Local System" and also "Local Service"
but the end result is , it is working only for Localhost connections and not
for Remote Connections...

the code for server is as follows..

////////////************Server Code starts here**********//////////////////
IPAddress ipAddress = Dns.Resolve("localhost").AddressList[0];
TcpListener listener = new TcpListener(ipAddress,portNum);
try
{
listener.Start();
TcpClient handler = listener.AcceptTcpClient();
////extra things done here
}
////////////************Server Code starts here**********//////////////////

but the remote connections are not getting connected.......why so?

with regards,
C.C.Chakkaradeep


Nov 16 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a


"Chakkaradeep" <Ch**********@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.com...
hi all,

I have written a C# Service which is a Server accepting Clients,It is
working fine when i connect from localhost but when i connect from any
other
machine to my machine , the service is not working, the Service is in
"Network Service".....i even tried "Local System" and also "Local Service"
but the end result is , it is working only for Localhost connections and
not
for Remote Connections...

the code for server is as follows..

////////////************Server Code starts
here**********//////////////////
IPAddress ipAddress = Dns.Resolve("localhost").AddressList[0];
TcpListener listener = new TcpListener(ipAddress,portNum);
try
{
listener.Start();
TcpClient handler = listener.AcceptTcpClient();
////extra things done here
}
////////////************Server Code starts
here**********//////////////////

but the remote connections are not getting connected.......why so?


How would you like your clients to connect if you bind your listener to
'localhost' which resolves to 127.0.0.1?
You have to use your real host name, not the loopback address.

Willy.
Nov 16 '05 #2

P: n/a
hi willy,

this was really a silly but a BIG mistake........thanks for the reply....

with regards,
C.C.Chakkaradeep

"Willy Denoyette [MVP]" wrote:


"Chakkaradeep" <Ch**********@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.com...
hi all,

I have written a C# Service which is a Server accepting Clients,It is
working fine when i connect from localhost but when i connect from any
other
machine to my machine , the service is not working, the Service is in
"Network Service".....i even tried "Local System" and also "Local Service"
but the end result is , it is working only for Localhost connections and
not
for Remote Connections...

the code for server is as follows..

////////////************Server Code starts
here**********//////////////////
IPAddress ipAddress = Dns.Resolve("localhost").AddressList[0];
TcpListener listener = new TcpListener(ipAddress,portNum);
try
{
listener.Start();
TcpClient handler = listener.AcceptTcpClient();
////extra things done here
}
////////////************Server Code starts
here**********//////////////////

but the remote connections are not getting connected.......why so?


How would you like your clients to connect if you bind your listener to
'localhost' which resolves to 127.0.0.1?
You have to use your real host name, not the loopback address.

Willy.

Nov 16 '05 #3

P: n/a
hi,

my service is working fine..if i connect from the same machine to my server
which is also running in the same machine, there s no any delay but the same
if i connect to my service from anyother remote client, there s delay,it is
taking minimum 60 seconds.....is this my network problem r is that i have
fine tune somewhere n my Server....

with regards,
C.C.Chakkaradeep

"Chakkaradeep" wrote:
hi willy,

this was really a silly but a BIG mistake........thanks for the reply....

with regards,
C.C.Chakkaradeep

"Willy Denoyette [MVP]" wrote:


"Chakkaradeep" <Ch**********@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.com...
hi all,

I have written a C# Service which is a Server accepting Clients,It is
working fine when i connect from localhost but when i connect from any
other
machine to my machine , the service is not working, the Service is in
"Network Service".....i even tried "Local System" and also "Local Service"
but the end result is , it is working only for Localhost connections and
not
for Remote Connections...

the code for server is as follows..

////////////************Server Code starts
here**********//////////////////
IPAddress ipAddress = Dns.Resolve("localhost").AddressList[0];
TcpListener listener = new TcpListener(ipAddress,portNum);
try
{
listener.Start();
TcpClient handler = listener.AcceptTcpClient();
////extra things done here
}
////////////************Server Code starts
here**********//////////////////

but the remote connections are not getting connected.......why so?


How would you like your clients to connect if you bind your listener to
'localhost' which resolves to 127.0.0.1?
You have to use your real host name, not the loopback address.

Willy.

Nov 16 '05 #4

P: n/a


"Chakkaradeep" <Ch**********@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
hi,

my service is working fine..if i connect from the same machine to my
server
which is also running in the same machine, there s no any delay but the
same
if i connect to my service from anyother remote client, there s delay,it
is
taking minimum 60 seconds.....is this my network problem r is that i have
fine tune somewhere n my Server....

with regards,
C.C.Chakkaradeep

I wouldn't know, but I guess it's more likely a bug than a network problem.
I would try to telnet with your service (telnet servername port), to see
wheter it's a server or a client issue.

Willy.
Nov 16 '05 #5

P: n/a
Hi Willy,

i tried connecting by writing a Client program in Linux and connecting to my
server...within no time the Client connected..!!!!...but wht abt c#
Client??...is this s C# Client program??....i used TCPClient for writing
Client program...

with regards,
C.C.Chakkaradeep

"Willy Denoyette [MVP]" wrote:


"Chakkaradeep" <Ch**********@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
hi,

my service is working fine..if i connect from the same machine to my
server
which is also running in the same machine, there s no any delay but the
same
if i connect to my service from anyother remote client, there s delay,it
is
taking minimum 60 seconds.....is this my network problem r is that i have
fine tune somewhere n my Server....

with regards,
C.C.Chakkaradeep

I wouldn't know, but I guess it's more likely a bug than a network problem.
I would try to telnet with your service (telnet servername port), to see
wheter it's a server or a client issue.

Willy.

Nov 16 '05 #6

P: n/a

"Chakkaradeep" <Ch**********@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com...
Hi Willy,

i tried connecting by writing a Client program in Linux and connecting to
my
server...within no time the Client connected..!!!!...but wht abt c#
Client??...is this s C# Client program??....i used TCPClient for writing
Client program...


There must be something wrong in your C# client, step through it in the
debugger and look where it waits.

Willy.
Nov 16 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.