![]() |
Using the "Team Use" TCP ports
FRC allows the use of TCP ports 5800-5810 for our team use. I would like to use them to send arbitrary data from my driver station laptop, to the roboRIO. This may sound trivial at first, write a TCP client on the driver station, write a server on the roboRIO, and start sending data.
There is a problem with this though: The address of the roboRIO is determined by DCHP. This makes it impossible to know for sure what address to connect to from the laptop. I think the driver station software gets around this by using mDNS, but there's no support for mDNS in something like winsock. Along with this, I can't find anywhere in the documentation how to run code asynchronously, which is required for blocking network code. I also can't find any WPI support for networking, although there seems to be some standard Linux networking that works. Here is my code on both ends, both are taken almost entirely from examples: Client: Code:
#define WIN32_LEAN_AND_MEANCode:
#define MAX_SIZE 50 |
Re: Using the "Team Use" TCP ports
I know this doesn't answer your question, but you might want to take a look at NetworkTables and/or the SmartDashboard. They make communication between the DS and robot really easy without worrying about debugging network code. Even if you do not want to use the SmartDashboard, you can create your own tables for use in custom applications.
|
Re: Using the "Team Use" TCP ports
Quote:
|
Re: Using the "Team Use" TCP ports
I'm just wondering but why are you using two servers? TCP is bi-directional. If you really want to, you can thread your server and establish an incoming and outgoing connection.
5800-5810 are the only ports that you can use on the RoboRIO. The rest are firewalled off. I'm not sure about networked coprocessors. I'm sure that there are no restrictions on those. The FMS might not even care about them even being there. Just to be on the safe side, just use 5800-5810 on all devices. |
Re: Using the "Team Use" TCP ports
mDNS should work through winsock.
|
Re: Using the "Team Use" TCP ports
Quote:
|
Re: Using the "Team Use" TCP ports
Thanks for your replies guys!
I thought static IP addresses could only be given through the router, which is reset at the beginning of competitions, but assigning it through the roboRIO will do the trick. About the port numbers, I saw that the server code running on the roboRIO opens a new port for incoming connections, which would most likely end up being blocked by the firewall. Would it make more sense to wait for a connection on the driver station end? That would allow the port for outbound connections from the roboRIO to be known and assigned to. I'm not super experienced with network code, but optimally I'll find a way to make a P2P connection. As for network tables, I decided against them because, as I understand it, you would need an additional library to access them. Network tables also come with bandwidth overhead, and I've run into a race condition with them before. Thanks again! |
| All times are GMT -5. The time now is 08:09. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi