system.net.sockets.socketexception(0x80004005)
no connection could be made because the target machine actively refused it 192.168.1.7:1024
i need to know what is the problem and how can solve
i try to ping that 192.168.1.7 (this access point take ip through tcp/ ip module )and that replay no problem
int
port =
1024
;
TcpClient client =
new
TcpClient(server, port);
Byte[] data = System.Text.Encoding.ASCII.GetBytes(message);
NetworkStream stream = client.GetStream();
stream.Write(data,
0
, data.Length);
System.Windows.Forms.MessageBox.Show(
"
Sent: {0}"
+ message); ;
data =
new
Byte[256];
String
responseData =
String
.Empty;
Int32
bytes = stream.Read(data,
0
, data.Length);
responseData = System.Text.Encoding.ASCII.GetString(data,
0
, bytes);
System.Windows.Forms.MessageBox.Show(
"
recieved: {0}"
+ responseData);
catch
(ArgumentNullException e)
System.Windows.Forms.MessageBox.Show(
"
ArgumentNullException: {0}"
+ e);
catch
(SocketException e)
System.Windows.Forms.MessageBox.Show(
"
SocketException: {0}"
+ e);
System.Windows.Forms.MessageBox.Show(
"
\n Press Enter to continue..."
);
Console.Read();
According to exception - no service listens on this port at this host.
You can check if this port is open using telnet program
telnet
192
.
168
.
1
.
7
1024
To resolve - ensure, that on host some application listens to this port.
Read the question carefully.
Understand that English isn't everyone's first language so be lenient of bad
spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or
edit the question
and fix the problem. Insults are not welcome.
Don't tell someone to read the manual. Chances are they have and don't get it.
Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Vyacheslav Voronenko
you mean insert that (telnet 192.168.1.7 1024)to my code . i already insert it to the code but it isn't identified how can i identify it ?
i am searching in this is exception and i find that may because of the firewall of my host (192.168.1.7) block the call. so do you think the problem is in hardware or in my application