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

Service not working in Network?

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
6 1930


"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
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
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


"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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: mailme.faisal | last post by:
I have created a service that create a process. The service is running in local system account & it also create the new process in system account. In process i have to access network resource ....
5
by: Belsam | last post by:
Hi all I need to create a windows service that will wait for a file to be copied somewhere, write it to the database, and then move the file to a storage area. I don't know when the file will...
6
by: Rob | last post by:
Hi, I am working on a project that requires a Windows Service which performs the following file transfer functions. 1. It monitors a specific local directory on a Windows 2003 Server. 2. When...
5
by: Mark Rae | last post by:
Hi, I'm looking for advice concerning what to do if a Windows service does not find a "viable" working environment at startup. E.g. I have a Windows service which does the following: 1)...
5
by: Martin | last post by:
Hi, Transferred a working ASP.Net app and database to a new machine and domain. The app should be running as the local aspnet account (<processModel userName="machine" password="AutoGenerate"...
8
by: Kevin D. | last post by:
Please note, I already posted this on the MySQL official forum, but received no response. I thought I'd try again in another location. My apologies to anyone reading this twice... Despite...
2
by: Mike | last post by:
Can a vb program running as a serice not use network paths to do file/io? I can't seem to get my program to work with network paths and files. When I use local disk it works fine. When I run it...
5
by: cj2 | last post by:
This code works: using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Linq; using System.Web; using System.Web.Services; using...
2
by: | last post by:
Hi all, I have an asp.net 2.0 website that accesses a locally hosted web service. This works fine on servers that are connected to our network. However, I am having a problem with a laptop...
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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.