MantisBT - VTK | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0000148 | VTK | (No Category) | public | 2003-08-15 02:49 | 2011-01-13 17:00 |
Reporter | Robert Belleman | ||||
Assigned To | Berk Geveci | ||||
Priority | urgent | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | OS | OS Version | |||
Product Version | |||||
Target Version | Fixed in Version | ||||
Project | |||||
Type | |||||
Summary | 0000148: vtkSocketCommunicator can not bind socket to address that is in use | ||||
Description | I 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); | ||||
Steps To Reproduce | |||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
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) |
Notes | |||||
|
|||||
|
|