forked from ros-industrial/industrial_core
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More formal fix for UDP communication.
This should now make UDP sockets act almost exactly like the TCP sockets. The primary difference I notice at the moment is that makeConnect is necessarily blocking for UDP, while for TCP it just connects without the need for a handshake. Here is a list of the changes: - UdpSocket now has its own read buffer. For rawReceiveBytes, it now only does a RECV_FROM to its UDP-specific buffer when there is no data in it. Then it copies whatever it can from that buffer into the requested buffer. The rawPoll operation acts almost the same as the previous poll, except it goes ahead and returns as ready when there is data left in the internal buffer. Thus, we should get almost the same functionality overall as the TCP code. - Removed original "fixes" I put in. receiveBytes acts the same as originally. - SimpleSocket::setConnected is now public (this is the only way you can encourage a socket to try and connect again, if you timeout in cyclic communication, the server should set this to false and try connecting again when it gets information on the point) - SimpleSocket::poll is now a virtual method named rawPoll to be implemented by *Socket (this is due to how UDP does reads now). TCP's poll code is identical to the original. - UdpServer::makeConnect doesn't hard-block waiting for the handshake message anymore. - I have refactored most of the utest.cpp code to make it possible to run the same tests for both TCP and UDP. Most of the code is identical, except that the makeConnect calls have to be run differently. Since for UDP, each call is blocking until the handshake is completed, you must call one of them in a thread. It seems that this works fine for both TCP and UDP though. - I have added a new test which enables the UDP_TEST macro in the utest.cpp.
- Loading branch information
Showing
9 changed files
with
256 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.