Mark Jones
2013-03-01 19:14:47 UTC
Hi,
What I am seeing is present in both 1.44 and 1.49.
If I try to open a port on Windows 7 this way:
_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::v4(), _portToTry ) ) );
and succeed and then try again with the same port number in a completely different class instance, it will fail. This is correct and expected behavior.
However, if I instead try the following in a completely difference class instance with the same port number after a successful port opening as shown above:
_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::endpoint().address().from_string( _localIPAddress ), _portToTry ) ) );
it will succeed on Windows (and break the first listening socket), but it will not succeed and will not break the first listening socket on Mac OS X. I believe the behavior on Mac OS X is correct and the behavior on Windows 7 is likely not.
Is this a known bug on Windows?
So in other words, the following works correctly:
Class instance 1:
m_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::v4(), 49152) ) ); // success
Class instance 2:
m_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::v4(), 49152) ) ); // fail
And the following works in a way that I believe is incorrect on Windows:
Class instance 1:
m_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::v4(), 49152) ) ); // success
Class instance 2:
_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::endpoint().address().from_string( _localIPAddress ), 49152) ) ); // success and now Class instance 1 is no longer receiving packets
Whereas, on Mac OS X the following would be the case and I believe this is what should happen on all operating systems:
Class instance 1:
m_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::v4(), 49152) ) ); // success
Class instance 2:
_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::endpoint().address().from_string( _localIPAddress ), 49152) ) ); // failure
Thanks,
Mark
Mark Jones
Senior Software Engineer
Mobile Sensor and Network Data Acquisition
-
MathWorks
3 Apple Hill Drive
Natick, MA 01760 USA
www.mathworks.com<http://www.mathworks.com/>
-
Main: 1-508-647-7000
Direct: 1-508-647-7347
Fax: 1-508-647-7001
What I am seeing is present in both 1.44 and 1.49.
If I try to open a port on Windows 7 this way:
_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::v4(), _portToTry ) ) );
and succeed and then try again with the same port number in a completely different class instance, it will fail. This is correct and expected behavior.
However, if I instead try the following in a completely difference class instance with the same port number after a successful port opening as shown above:
_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::endpoint().address().from_string( _localIPAddress ), _portToTry ) ) );
it will succeed on Windows (and break the first listening socket), but it will not succeed and will not break the first listening socket on Mac OS X. I believe the behavior on Mac OS X is correct and the behavior on Windows 7 is likely not.
Is this a known bug on Windows?
So in other words, the following works correctly:
Class instance 1:
m_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::v4(), 49152) ) ); // success
Class instance 2:
m_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::v4(), 49152) ) ); // fail
And the following works in a way that I believe is incorrect on Windows:
Class instance 1:
m_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::v4(), 49152) ) ); // success
Class instance 2:
_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::endpoint().address().from_string( _localIPAddress ), 49152) ) ); // success and now Class instance 1 is no longer receiving packets
Whereas, on Mac OS X the following would be the case and I believe this is what should happen on all operating systems:
Class instance 1:
m_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::v4(), 49152) ) ); // success
Class instance 2:
_socket.reset( new udp::socket( *_ioService, udp::endpoint( udp::endpoint().address().from_string( _localIPAddress ), 49152) ) ); // failure
Thanks,
Mark
Mark Jones
Senior Software Engineer
Mobile Sensor and Network Data Acquisition
-
MathWorks
3 Apple Hill Drive
Natick, MA 01760 USA
www.mathworks.com<http://www.mathworks.com/>
-
Main: 1-508-647-7000
Direct: 1-508-647-7347
Fax: 1-508-647-7001