View Single Post
  #5   Spotlight this post!  
Unread 11-02-2014, 12:45
Domenic Rodriguez's Avatar
Domenic Rodriguez Domenic Rodriguez is offline
Registered User
FRC #0316 (LuNaTeCs)
Team Role: College Student
 
Join Date: Sep 2010
Rookie Year: 2011
Location: Grove City, PA
Posts: 213
Domenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura aboutDomenic Rodriguez has a spectacular aura about
Re: Java and C++ integration, UDP/TCP

Quote:
Originally Posted by yash101 View Post
What about UDP/TCP 1234, etc. Does it mean that that port is blocked?
Yes; Section 2.2.8 of the manual specifies the open ports on the field:
Quote:
Once plugged in to the Field Management System (FMS) via the Ethernet cable provided, the only open ports in the ARENA network are as follows:

TCP 1180: This port is typically used for camera data from the cRIO to the Driver Station (DS) when the camera is connected to port 2 on the 8-slot cRIO (P/N: cRIO-FRC). This port is bidirectional.
TCP 1735: SmartDashboard, bidirectional
UDP 1130: Dashboard-to-ROBOT control data, directional
UDP 1140: ROBOT-to-Dashboard status data, directional
HTTP 80: Camera connected via switch on the ROBOT, bidirectional
HTTP 443: Camera connected via switch on the ROBOT, bidirectional

Teams may use these ports as they wish if they do not employ them as outlined above (i.e. TCP 1180 can be used to pass data back and forth between the ROBOT and the DS if the team chooses not to use the camera on port 2).
It looks like Java ME sockets work a bit differently than Java SE sockets. You use the Connector class to open a StreamConnection or SocketConnection object. The Javadocs give an example:
Code:
SocketConnection sc = (SocketConnection) Connector.open("socket://10.xx.yy.5:1180");
sc.setSocketOption(SocketConnection.LINGER, 5);

InputStream is = sc.openInputStream();
OutputStream os = sc.openOutputStream();

os.write("\r\n".getBytes());
int ch = 0;
while(ch != -1) {
    ch = is.read();
}

is.close();
os.close();
sc.close();
Note that I have not used these classes, so YMMV.
__________________

LuNaTeCs - Learning Under Nurturing Adults Teaching Engineering Concepts and Skills - Small and Mighty!

FRC 316 LuNaTeCs - Student (2011-2014), Lead Programmer (2011-2014), Team Captain (2013-2014), Operator (2013), Drive Coach (2014), Mentor (2015-????)
'11 Philly Regional Finalists, '13 Chestnut Hill Finalists, '13 Lenape Champions, '13 Archimedes Division, '14 Chestnut Hill Champions, '14 Lenape Champions
FTC 7071 EngiNerds - Founding Advisor (2013-2014) | FRC 5420 Velocity - Founding Advisor (2015)
Grove City College Class of '18, Electrical/Computer Engineering (B.S.E.E)


Last edited by Domenic Rodriguez : 11-02-2014 at 12:55. Reason: Added more info