I have a socket listener and a test app.
The socket listener app: opens up the port 51296 and listens.
The test app - sends a message on port 51296.
If the listener and test app are on the same box, all is well - everything
works as expected.
But when I move my test app to a remote box: I get the following error:
"no connection could be made because the target machine actively refused it"
--------------------------------------------------
This is the listener code:
IPHostEntry hostEntry = Dns.GetHostEntr y(myserver.doma in.com);
IPEndPoint ipe = new IPEndPoint(host Entry.AddressLi st[0], 51296);
Socket soc =
new Socket(ipe.Addr essFamily, SocketType.Stre am, ProtocolType.Tc p);
soc.Connect(ipe );
soc.Send(Encodi ng.ASCII.GetByt es("some text message"));
soc.Close();
------------------------------------------------------------------------------------------------
I have firewall enabled on the server box (where the listener is running).
I tried setting the firewall options to unblock the port 51296 for all
traffic.
That did not work.
Any ideas on how to detect where the problem is..?
Thanks much
Jay 11 2886
Definitely sounds like the firewall or some other thing cauing the issue.
You sure no other app is running that port on that machine? did you check
the client is also not blocking that port?
I usually turn off everything, antivirus progs everything (best to not be on
the net when you do this) and all firewalls. Then try, if it works i start
to put them on one by one until it doesn't work. Then fix the app causing
the block.
"Jay" <Ja*@microsoft. comwrote in message
news:%2******** *******@TK2MSFT NGP04.phx.gbl.. .
>I have a socket listener and a test app.
The socket listener app: opens up the port 51296 and listens.
The test app - sends a message on port 51296.
If the listener and test app are on the same box, all is well - everything
works as expected.
But when I move my test app to a remote box: I get the following error:
"no connection could be made because the target machine actively refused
it"
--------------------------------------------------
This is the listener code:
IPHostEntry hostEntry = Dns.GetHostEntr y(myserver.doma in.com);
IPEndPoint ipe = new IPEndPoint(host Entry.AddressLi st[0], 51296);
Socket soc =
new Socket(ipe.Addr essFamily, SocketType.Stre am, ProtocolType.Tc p);
soc.Connect(ipe );
soc.Send(Encodi ng.ASCII.GetByt es("some text message"));
soc.Close();
------------------------------------------------------------------------------------------------
I have firewall enabled on the server box (where the listener is running).
I tried setting the firewall options to unblock the port 51296 for all
traffic.
That did not work.
Any ideas on how to detect where the problem is..?
Thanks much
Jay
I cannot turn off the firewall. Its set by the corporate group policy.
I have admin previlages to modify, but not turn it off completely.
"PokerMan" <no****@pokerca t.co.ukwrote in message
news:uz******** ******@TK2MSFTN GP06.phx.gbl...
Definitely sounds like the firewall or some other thing cauing the issue.
You sure no other app is running that port on that machine? did you check
the client is also not blocking that port?
I usually turn off everything, antivirus progs everything (best to not be
on the net when you do this) and all firewalls. Then try, if it works i
start to put them on one by one until it doesn't work. Then fix the app
causing the block.
"Jay" <Ja*@microsoft. comwrote in message
news:%2******** *******@TK2MSFT NGP04.phx.gbl.. .
>>I have a socket listener and a test app. The socket listener app: opens up the port 51296 and listens. The test app - sends a message on port 51296. If the listener and test app are on the same box, all is well - everything works as expected. But when I move my test app to a remote box: I get the following error: "no connection could be made because the target machine actively refused it" -------------------------------------------------- This is the listener code: IPHostEntry hostEntry = Dns.GetHostEntr y(myserver.doma in.com);
IPEndPoint ipe = new IPEndPoint(host Entry.AddressLi st[0], 51296);
Socket soc =
new Socket(ipe.Addr essFamily, SocketType.Stre am, ProtocolType.Tc p);
soc.Connect(ip e);
soc.Send(Encod ing.ASCII.GetBy tes("some text message"));
soc.Close();
------------------------------------------------------------------------------------------------
I have firewall enabled on the server box (where the listener is running).
I tried setting the firewall options to unblock the port 51296 for all traffic.
That did not work.
Any ideas on how to detect where the problem is..?
Thanks much
Jay
Hi,
"Jay" <Ja*@microsoft. comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
|I cannot turn off the firewall. Its set by the corporate group policy.
| I have admin previlages to modify, but not turn it off completel
Well, then how do you expect that the remote client can connect to your
server if there is a firewall?
Either you remove your firewall or at least allow that port to pass through.
--
Ignacio Machin
machin AT laceupsolutions com
Ignacio, at end of his post he says:
"I have firewall enabled on the server box (where the listener is running).
I tried setting the firewall options to unblock the port 51296 for all
traffic.
That did not work."
My best advice since you cant turn it off is try changing the port number
and see if you have more luck. Sounds like the firewall is the reason
though. Do check if there is anything else blocking that port.
As a check try this, start your app listening.
then open a command prompt and type Netstat -a
This shows all connections. Ensure your app is listening on the port you
mentioned. If it is then try telnet to that port and see if the server lets
that through. I am sure you'll find it doesnt due to the firewall, if it
does then there is a problem with your client end software on how it
connects.
Definitely sounds like an administrative problem not a code one though.
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in
message news:eE******** ******@TK2MSFTN GP06.phx.gbl...
Hi,
"Jay" <Ja*@microsoft. comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
|I cannot turn off the firewall. Its set by the corporate group policy.
| I have admin previlages to modify, but not turn it off completel
Well, then how do you expect that the remote client can connect to your
server if there is a firewall?
Either you remove your firewall or at least allow that port to pass
through.
--
Ignacio Machin
machin AT laceupsolutions com
I am allowing that port to pass through.
But still I cannot see the messages come through.
Are there any tools that I can use to monitor what is happening?
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in
message news:eE******** ******@TK2MSFTN GP06.phx.gbl...
Hi,
"Jay" <Ja*@microsoft. comwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
|I cannot turn off the firewall. Its set by the corporate group policy.
| I have admin previlages to modify, but not turn it off completel
Well, then how do you expect that the remote client can connect to your
server if there is a firewall?
Either you remove your firewall or at least allow that port to pass
through.
--
Ignacio Machin
machin AT laceupsolutions com
Your code snippet says listener code but it looks more like client code.
Does an nslookup of myserver.domain .com return only one IP address?
Do you know which IP and/or interface AddressList[0] is binding too? Does
the server use similar code to setup the listener? Is it possible it's
binding to an IP that the remote machine does not have a route to? For
example, I have VMWare on my machine so there are 2 virtual adapters that
have private IPs that are not part of our local subnet. If my software
listened on one of those then remote machines would have no way of
connecting to me, but the same client running on my workstation would. Make
sure you are listening on the interface and IP you think you are listening
on.
jim
"Jay" <Ja*@microsoft. comwrote in message
news:%2******** *******@TK2MSFT NGP04.phx.gbl.. .
>I have a socket listener and a test app.
The socket listener app: opens up the port 51296 and listens.
The test app - sends a message on port 51296.
If the listener and test app are on the same box, all is well - everything
works as expected.
But when I move my test app to a remote box: I get the following error:
"no connection could be made because the target machine actively refused
it"
--------------------------------------------------
This is the listener code:
IPHostEntry hostEntry = Dns.GetHostEntr y(myserver.doma in.com);
IPEndPoint ipe = new IPEndPoint(host Entry.AddressLi st[0], 51296);
Socket soc =
new Socket(ipe.Addr essFamily, SocketType.Stre am, ProtocolType.Tc p);
soc.Connect(ipe );
soc.Send(Encodi ng.ASCII.GetByt es("some text message"));
soc.Close();
------------------------------------------------------------------------------------------------
I have firewall enabled on the server box (where the listener is running).
I tried setting the firewall options to unblock the port 51296 for all
traffic.
That did not work.
Any ideas on how to detect where the problem is..?
Thanks much
Jay
Your code snippet says listener code but it looks more like client code.
Does an nslookup of myserver.domain .com return only one IP address?
Do you know which IP and/or interface AddressList[0] is binding too? Does
the server use similar code to setup the listener? Is it possible it's
binding to an IP that the remote machine does not have a route to? For
example, I have VMWare on my machine so there are 2 virtual adapters that
have private IPs that are not part of our local subnet. If my software
listened on one of those then remote machines would have no way of
connecting to me, but the same client running on my workstation would. Make
sure you are listening on the interface and IP you think you are listening
on.
jim
"Jay" <Ja*@microsoft. comwrote in message
news:%2******** *******@TK2MSFT NGP04.phx.gbl.. .
>I have a socket listener and a test app.
The socket listener app: opens up the port 51296 and listens.
The test app - sends a message on port 51296.
If the listener and test app are on the same box, all is well - everything
works as expected.
But when I move my test app to a remote box: I get the following error:
"no connection could be made because the target machine actively refused
it"
--------------------------------------------------
This is the listener code:
IPHostEntry hostEntry = Dns.GetHostEntr y(myserver.doma in.com);
IPEndPoint ipe = new IPEndPoint(host Entry.AddressLi st[0], 51296);
Socket soc =
new Socket(ipe.Addr essFamily, SocketType.Stre am, ProtocolType.Tc p);
soc.Connect(ipe );
soc.Send(Encodi ng.ASCII.GetByt es("some text message"));
soc.Close();
------------------------------------------------------------------------------------------------
I have firewall enabled on the server box (where the listener is running).
I tried setting the firewall options to unblock the port 51296 for all
traffic.
That did not work.
Any ideas on how to detect where the problem is..?
Thanks much
Jay
I tried changing the port number to 80 (which is a http port and it is
unblocked)
That did not work.
I did a netstat -a .
I saw that the app was listening on the port.
But when I tried "telnet <servername5129 6", it did not go through.
What else can I do?
"PokerMan" <no****@pokerca t.co.ukwrote in message
news:uN******** ******@TK2MSFTN GP03.phx.gbl...
Ignacio, at end of his post he says:
"I have firewall enabled on the server box (where the listener is
running).
I tried setting the firewall options to unblock the port 51296 for all
traffic.
That did not work."
My best advice since you cant turn it off is try changing the port number
and see if you have more luck. Sounds like the firewall is the reason
though. Do check if there is anything else blocking that port.
As a check try this, start your app listening.
then open a command prompt and type Netstat -a
This shows all connections. Ensure your app is listening on the port you
mentioned. If it is then try telnet to that port and see if the server
lets that through. I am sure you'll find it doesnt due to the firewall, if
it does then there is a problem with your client end software on how it
connects.
Definitely sounds like an administrative problem not a code one though.
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in
message news:eE******** ******@TK2MSFTN GP06.phx.gbl...
>Hi,
"Jay" <Ja*@microsoft. comwrote in message news:%2******* *********@TK2MS FTNGP02.phx.gbl ... |I cannot turn off the firewall. Its set by the corporate group policy. | I have admin previlages to modify, but not turn it off completel
Well, then how do you expect that the remote client can connect to your server if there is a firewall?
Either you remove your firewall or at least allow that port to pass through.
-- Ignacio Machin machin AT laceupsolutions com
Do a netstat -an and check the IP that the listener is bound to. Then try
to telnet to that IP and port instead of machine name and port. Also ping
that IP from the remote to make sure there is a route in place.
jim
"Jay" <Ja*@microsoft. comwrote in message
news:ur******** ******@TK2MSFTN GP03.phx.gbl...
>I tried changing the port number to 80 (which is a http port and it is unblocked)
That did not work.
I did a netstat -a .
I saw that the app was listening on the port.
But when I tried "telnet <servername5129 6", it did not go through.
What else can I do?
"PokerMan" <no****@pokerca t.co.ukwrote in message
news:uN******** ******@TK2MSFTN GP03.phx.gbl...
>Ignacio, at end of his post he says:
"I have firewall enabled on the server box (where the listener is running).
I tried setting the firewall options to unblock the port 51296 for all traffic.
That did not work."
My best advice since you cant turn it off is try changing the port number and see if you have more luck. Sounds like the firewall is the reason though. Do check if there is anything else blocking that port.
As a check try this, start your app listening.
then open a command prompt and type Netstat -a
This shows all connections. Ensure your app is listening on the port you mentioned. If it is then try telnet to that port and see if the server lets that through. I am sure you'll find it doesnt due to the firewall, if it does then there is a problem with your client end software on how it connects.
Definitely sounds like an administrative problem not a code one though.
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in message news:eE******** ******@TK2MSFTN GP06.phx.gbl...
>>Hi,
"Jay" <Ja*@microsoft. comwrote in message news:%2****** **********@TK2M SFTNGP02.phx.gb l... |I cannot turn off the firewall. Its set by the corporate group policy. | I have admin previlages to modify, but not turn it off completel
Well, then how do you expect that the remote client can connect to your server if there is a firewall?
Either you remove your firewall or at least allow that port to pass through.
-- Ignacio Machin machin AT laceupsolutions com
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robert A. van Ginkel |
last post by:
Hello Fellow Developer,
I use the System.Net.Sockets to send/receive data (no
tcpclient/tcplistener), I made a receivethread in my wrapper, the
receivethread loops/sleeps while waiting for data and then fires a
datareceived event.
Within the waitingloop there is a timeout function, but I want the the
'last-time-socket-used' variable set when the socket is finished sending.
When I send by System.Net.Sockets.Socket.Send(buffer()) (<--this...
|
by: Droopy |
last post by:
Hi,
I try to implement a reusable socket class to send and receive data.
It seems to work but I have 2 problems :
1) I rely on Socket.Available to detect that the connection is closed (no
more data to expect). Sometimes, Socket.Available returns 0 but the other
end of the connection did not close it !
2) This class will be used by many other classes so I have to use the
|
by: Rene Sørensen |
last post by:
We are 4 students working on a assignment, that our teacher gave use,
normally we do this is C++, but the 4 of us, use C# more often that
C++ so…
We made a small games called reversi, now our job is to make a server,
none of us know nothing about socket programming in C#, but we founds
some guides for this, and now ,got a server running, but we have some
problems though. We have 2 scenario, one where we use a telnet
connection and one...
|
by: |
last post by:
Hi all,
I have a simple .aspx page running on net 2.0 that is trying to do a http
post to a remote server. Here is the code
Private Function ProcessRequests(ByVal strbody As String) As String
Dim returnstr As String
Dim URL As String = "http://www.dydomain.com/test.asp"
|
by: bobano |
last post by:
Hi everyone,
I am writing a POP3 Client program in Perl. You connect to a POP3 Server and have a running conversation with the mail server using commands from the RFC 1939 Post Office Protocol. This program can perform 5 options from a menu on your POP3 mail by logging in with the correct POP3 server along with a user name and password that you use to log in to your ISP. The user name and password as well as the server name are all hard-coded...
| |
by: John Nagle |
last post by:
Here's a strange little bug. "socket.getaddrinfo" blows up
if given a bad domain name containing ".." in Unicode. The
same string in ASCII produces the correct "gaierror" exception.
Actually, this deserves a documentation mention. The "socket" module,
given a Unicode string, calls the International Domain Name parser,
"idna.py", which has a a whole error system of its own. The IDNA
documentation says that "Furthermore, the socket...
|
by: John Nagle |
last post by:
Here are three network-related exceptions. These
were caught by "except" with no exception type, because
none of the more specific exceptions matched. This
is what a traceback produced:
1. File "D:\Python24\lib\socket.py", line 295, in read
data = self._sock.recv(recv_size)
timeout: timed out
|
by: ahlongxp |
last post by:
Hi, everyone,
I'm implementing a simple client/server protocol.
Now I've got a situation:
client will send server command,header paires and optionally body.
server checks headers and decides whether to accept(read) the body.
if server decided to throw(dump) the request's body, it'll send back a
response message, such as "resource already exists" and close the
connection.
|
by: Hendrik van Rooyen |
last post by:
While doing a netstring implementation I noticed that if you
build a record up using socket's recv(1), then when you close
the remote end down, the recv(1) hangs, despite having a short
time out of 0.1 set.
If however, you try to receive more than one char, (I tested with 3,
did not try 2), then when you shut the remote end down you do not
get a time out, but an empty string - the normal end of file, I suppose.
Has anybody else seen...
|
by: manasap |
last post by:
Hi all!
I've written a server and a client application using asynchronous sockets.The client sends data packets for every 7 seconds.The server receives the packets.
This process proceeds smoothly without any errors but,sometimes I get the following error.
"An existing connection was forcibly closed by the remote host."
Why is this happening when i am not closing the client program?
Could someone guide me in this issue
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |