473,320 Members | 2,071 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,320 software developers and data experts.

System.Net.Sockets.SocketException:

System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it.

I kept getting this problem when trying to run a TcpServer and a TcpClient on two separate computers. This error would not happen when I ran the programs on the same machines.

I was't able to find an answer after searching but I eventually discovered my error. Coming from a Java programming background this would have never happened in Java that is why I never considered it.

Here's the answer....

If you create the server app to listen on the local host loopback address 127.0.0.1 and you try to connect remotely it will throw the above mentioned exception. If you change the server address from the loopback address to it's actual LAN IP address, the program will work.

I hope this saves someone the time i spent trying to research this issue.

Ken Zrobok
<email link removed>
Jun 26 '06 #1
4 24683
Hi..
I got the same error that u hav mentioned. But am unable to carry out ur suggestions. I'm a novice in this field. Can u tell me how to set the server address..?
Dec 8 '08 #2
SvenV
50
sumbadielse, You also get this error when you have closed for instance the socket on the server side. What I would suggest is posting some code that we can investigate.

Kind Regards,
Sven
Dec 13 '08 #3
Frinavale
9,735 Expert Mod 8TB
@kennytlaloc: I have removed your email from your post. In the future, please do not post any email links. This is outlined as a rule in the posting guidelines (under the "Things that are Unacceptable" section). This rule is in place for your own safety.

-Moderator Frinny
Dec 15 '08 #4
Plater
7,872 Expert 4TB
The message: "No connection could be made because the target machine actively refused it." means it was able to discover that there was somebody there, but the requested port was not accepting connections.
Since it was able to know there was someone there, it is not a firewall issue.
Make sure that the "listener" side is up and running and accepting connections before attempting to connect. (also double check to make sure the ports being requested are the same)
Dec 15 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: paulbubach | last post by:
Hi @all, we have the following problem. We have developed an application with the Visual Studio.Net 2002 and the project runs on it. But now we have change the version of the Studio and now we...
0
by: Norb | last post by:
Hello i keep gettign this error when i use this code Error: An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in system.dll Additional information: An operation on...
0
by: Naresh | last post by:
All the components have been developed using .NET C#. I have a web service installed on a windows 2003 server machine. I have a client application running from 10 different machines and calling...
0
by: Saurabh | last post by:
I am doing Hands on Lab 33(WSE 2 chat program, last exercise) . When I run the 2 .exe's on same machine, the chat program works fine. But when I run the same exe on 2 different machines(within...
3
by: J C | last post by:
Hi, I'm using UDPClient to make a simple DNS server. I notice that intermittently and unpredictibly I get: Unhandled Exception: System.Net.Sockets.SocketException: An existing connection...
0
by: vincent | last post by:
Hi all, I'm getting this error when i running my applicaion with remote server from my local machine. An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in...
2
by: Steve Lowe | last post by:
Hi, I have a VB.Net 2003 program that uses Indy to check if there are any messages waiting on a POP mail server. The program has been running fine for a few months, but last week after...
4
by: sd1978 | last post by:
Hi, I have placed a webservice in the webserver. When I access it from a webpage, default.aspx on a click of a button i get the following error: No connection could be made because the target...
5
by: PJ6 | last post by:
I can't figure this out. I have several references to style sheets and javascript files in my page header, the contents of which are served dynamically by my httphandler that serves *.res requests....
1
by: larspeter | last post by:
Hi all. I have a problem with TcpClient ... I am conneting to a server with TcpClient and returning the answer through a webservice. It actully all works fine. BUT if I make a lot of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.