469,643 Members | 1,890 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

WinSock Error (Error code: 10054)

SK
Hi all,

I am dealing with sockets in my code.

I open them like -
System.Net.IPAddress remoteIPAddress = System.Net.IPAddress.Parse
(szIPSelected);
System.Net.IPEndPoint remoteEndPoint = new System.Net.IPEndPoint
(remoteIPAddress, alPort);
// Connect to the remote End point in the socket.
m_socClient.Connect(remoteEndPoint);

After having done my work I close it by-
m_socClient.Shutdown(SocketShutdown.Both);
m_socClient.Close();

I get an error "An existing connection was forcibly closed by the remote host
Error code: 10054" after running the application several times.
Am I missing on something?

Best regards,
SK
Nov 15 '05 #1
3 9834

This is normal error, what you must skip or handle.

This happens when computer you are connected to closes connection(without
ShutDown).
"SK" <sk@hotmail.com> wrote in message
news:<Ou**************@tk2msftngp13.phx.gbl>...
Hi all,

I am dealing with sockets in my code.

I open them like -
System.Net.IPAddress remoteIPAddress = System.Net.IPAddress.Parse
(szIPSelected);
System.Net.IPEndPoint remoteEndPoint = new System.Net.IPEndPoint
(remoteIPAddress, alPort);
// Connect to the remote End point in the socket.
m_socClient.Connect(remoteEndPoint);

After having done my work I close it by-
m_socClient.Shutdown(SocketShutdown.Both);
m_socClient.Close();

I get an error "An existing connection was forcibly closed by the remote host Error code: 10054" after running the application several times.
Am I missing on something?

Best regards,
SK

Nov 15 '05 #2
SK
So does that mean that I am bound to get such errors when opening/closing
sockets many times.
So is simply ignoring these error messages fine?
I was thinking that I made some mistake in closing the sockets.

Best regards,
SK

"Ivar" <iv**@lumisoft.ee> wrote in message
news:#f**************@tk2msftngp13.phx.gbl...

This is normal error, what you must skip or handle.

This happens when computer you are connected to closes connection(without
ShutDown).
"SK" <sk@hotmail.com> wrote in message
news:<Ou**************@tk2msftngp13.phx.gbl>...
Hi all,

I am dealing with sockets in my code.

I open them like -
System.Net.IPAddress remoteIPAddress = System.Net.IPAddress.Parse
(szIPSelected);
System.Net.IPEndPoint remoteEndPoint = new System.Net.IPEndPoint
(remoteIPAddress, alPort);
// Connect to the remote End point in the socket.
m_socClient.Connect(remoteEndPoint);

After having done my work I close it by-
m_socClient.Shutdown(SocketShutdown.Both);
m_socClient.Close();

I get an error "An existing connection was forcibly closed by the remote

host
Error code: 10054" after running the application several times.
Am I missing on something?

Best regards,
SK


Nov 15 '05 #3
So is simply ignoring these error messages fine? Usually yes, but it depends if you want notify your app that remote computer
closed connection.
I was thinking that I made some mistake in closing the sockets. I'm sure that your destination machine(server) causes this. If you send
Shutdown() then server won't
close connection as expected, it just closes it (No shutdown).

"SK" <sk@hotmail.com> wrote in message
news:<um**************@TK2MSFTNGP12.phx.gbl>... So does that mean that I am bound to get such errors when opening/closing
sockets many times.
So is simply ignoring these error messages fine?
I was thinking that I made some mistake in closing the sockets.

Best regards,
SK

"Ivar" <iv**@lumisoft.ee> wrote in message
news:#f**************@tk2msftngp13.phx.gbl...

This is normal error, what you must skip or handle.

This happens when computer you are connected to closes connection(without ShutDown).
"SK" <sk@hotmail.com> wrote in message
news:<Ou**************@tk2msftngp13.phx.gbl>...
Hi all,

I am dealing with sockets in my code.

I open them like -
System.Net.IPAddress remoteIPAddress = System.Net.IPAddress.Parse
(szIPSelected);
System.Net.IPEndPoint remoteEndPoint = new System.Net.IPEndPoint
(remoteIPAddress, alPort);
// Connect to the remote End point in the socket.
m_socClient.Connect(remoteEndPoint);

After having done my work I close it by-
m_socClient.Shutdown(SocketShutdown.Both);
m_socClient.Close();

I get an error "An existing connection was forcibly closed by the
remote host
Error code: 10054" after running the application several times.
Am I missing on something?

Best regards,
SK



Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Glen Conway | last post: by
1 post views Thread by Nicolas Ghesquiere | last post: by
osfreak
3 posts views Thread by osfreak | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.