473,507 Members | 9,611 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to close open socket

I would like to force a socket closed if it is currently open.

For arguments sake, say a function failed to close a socket and another
function would like to use this same socket.
I get the following error:
Only one usage of each socket address (protocol/network address/port) is
normally permitted

Obvously it would be better if the socket was closed correctly the 1st time,
but again, for arguments sake, please assume that it is left open and must
be forced closed by another function.

Thanks in advance.

Nov 20 '05 #1
1 6796
Hello,

"rooster575" <ro********@hotmail.com> schrieb:
I would like to force a socket closed if it is currently open.

For arguments sake, say a function failed to close a socket and another
function would like to use this same socket.
I get the following error:
Only one usage of each socket address (protocol/network address/port) is
normally permitted

Obvously it would be better if the socket was closed correctly the 1st time, but again, for arguments sake, please assume that it is left open and must
be forced closed by another function.


How do you close the socket? By calling its Close method? Post your code.

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1802
by: drs | last post by:
Hi, I have a program which opens a socket server in a thread. I need for the server to listen on the socket for a certain amount of time (say, ten seconds or so) and then close it, and am...
1
9471
by: KaXo | last post by:
$r_socket = IO::Socket::INET->new( PeerAddr => "10.0.26.78", PeerPort => 17990, Proto => 'tcp', Timeout => 1 ); ...................... if ($r_socket && $r_socket->connected()) {...
0
1407
by: Vitamin | last post by:
Hi All Professior, I am using JAVA to write a program that will open a socket and print something to server side. then I have close the socket in the JAVA already If I just running the .class...
3
9068
by: Daniel | last post by:
TcpClient close() method socket leak when i use TcpClient to open a connection, send data and close the TcpClient with myTcpClientInstance.Close(); it takes 60 seconds for the actual socket on...
9
11319
by: AA | last post by:
This is making me crazy!! Please, if some body can help me. I'm testing a ver simple socket client. In my test I just open and close a connection (in a loop) to my local IIS server (port 80)...
2
10787
by: L.J.SONG | last post by:
I use following code to create socket and connect to a server app: /// code ///// Socket connecter = null; IPEndPoint localEp = null; IPEndPoint remoteEp = null; IPHostEntry he =...
4
18085
by: Chris Tanger | last post by:
Context: C# System.Net.Sockets Socket created with constructor prarmeters Internetwork, Stream and TCP everything else is left at the default parameters and options except linger may be changed...
14
5890
by: =?Utf-8?B?TWlrZVo=?= | last post by:
I have a sync socket application. The client is blocked with Socket.Receive(...) in a thread, another thread calls Socket.Close(). This unblock the blocked thread. But the socket server is still...
3
4079
by: A. W. Dunstan | last post by:
I have an application that wants to open a Socket, write data and close the socket. A persistent connection would be nice, but it's intended to operate in an environment where the network...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5041
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
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...
0
3191
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...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1540
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 ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
411
bsmnconsultancy
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...

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.