View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000148VTK(No Category)public2003-08-15 02:492011-01-13 17:00
ReporterRobert Belleman 
Assigned ToBerk Geveci 
PriorityurgentSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000148: vtkSocketCommunicator can not bind socket to address that is in use
DescriptionI would like to suggest a small change that will allow vtkSocketCommunicator to bind() a socket to an address that is still (or already) in use.

While testing, it frequently happened to me that a call to vtkSocketCommunicator::WaitForConnection(int port) fails because sockets from a previous run are still in a final closing/wait state. During that time, a bind() by a new run will fail with a "address already in use" error.

The patch below fixes that by allowing the address to be reused.

This change has been tested on Linux. I checked Window's API docs and other manual pages; this change should work equally well on other systems.

Context diff follows:

--------------------------------------------------
Index: vtkSocketCommunicator.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Parallel/vtkSocketCommunicator.cxx,v
retrieving revision 1.40
diff -c -r1.40 vtkSocketCommunicator.cxx
*** vtkSocketCommunicator.cxx 29 Apr 2003 17:15:37 -0000 1.40
--- vtkSocketCommunicator.cxx 29 Jul 2003 09:45:35 -0000
***************
*** 286,291 ****
--- 286,296 ----
    server.sin_family = AF_INET;
    server.sin_addr.s_addr = INADDR_ANY;
    server.sin_port = htons(port);
+
+ // Allow the socket to be bound to an address that is already in use
+ int opt=1;
+ setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &opt, sizeof(int));
+
    if ( bind(sock, (sockaddr *)&server, sizeof(server)) )
      {
      vtkErrorMacro("Can not bind socket to port " << port);
TagsNo tags attached.
Project
Type
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0000395)
Berk Geveci (administrator)
2003-12-23 10:48

Fix now in ParaView trunk.

- Issue History
Date Modified Username Field Change
2007-08-28 14:58 Zack Galbreath Project @8@ => VTK
2007-08-28 14:58 Zack Galbreath Assigned To Will Schroeder => Berk Geveci
2007-08-28 14:58 Zack Galbreath Status backlog => closed
2007-08-28 14:58 Zack Galbreath Resolution duplicate => fixed
2007-08-28 14:58 Zack Galbreath Summary Goodsite => vtkSocketCommunicator can not bind socket to address that is in use
2007-08-28 14:59 Zack Galbreath Note Deleted: 0008215
2010-11-29 17:59 Berk Geveci Source_changeset_attached => VTK master db58ff40
2011-01-13 17:00 Source_changeset_attached => VTK master a2bd8391
2011-01-13 17:00 Source_changeset_attached => VTK master 020ef709
2011-06-16 13:11 Zack Galbreath Category => (No Category)


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker