Author Topic: UDP Sockets  (Read 433 times)

0 Members and 1 Guest are viewing this topic.

Offline LBR_Slave

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 62
UDP Sockets
« on: February 20, 2018, 03:02:00 PM »
Hello All,
I have a fairly complex application utilising a couple of sockets for UDP coms between agents and I have recently introduced a 3rd socket for intermittent file transfers between robot and PC.
The third socket does weird stuff.

in a standalone application it works great, transfers file all OK.

in the greater application i get  a funny comment coming through the syso java.net Datagram Socket @96eac and the socket connects nor opens or transfers the file.

Do I have a limit on the LBR controller for maximum number of sockets?

Many Thanks

Offline razzo

  • Jr. Member
  • **
  • Thank You
  • -Given: 1
  • -Receive: 11
  • Posts: 67
Re: UDP Sockets
« Reply #1 on: February 20, 2018, 07:17:17 PM »
Every SunriseWorkbench comes with a manual. Did you look in there? Because there is your answer!

RTFM!
Chapter: 15.5 Network communication via UDP and TCP/IP
Quote
Certain ports are enabled on the robot controller for communication with external
devices via UDP or TCP/IP.
The following port numbers (client or server socket) can be used in a robot application:
30,000 to 30,010

Regards
razzo

Offline LBR_Slave

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 62
Re: UDP Sockets
« Reply #2 on: February 21, 2018, 07:43:40 AM »
Hi Razzo,
I did read the manual, my request for help was a little more embellished - although I always hope for a simple fix - its not always apparent.

To reiterate I have two working sockets, the third doesn't appear to work - although it works when in a standalone application....

Best regards

Offline razzo

  • Jr. Member
  • **
  • Thank You
  • -Given: 1
  • -Receive: 11
  • Posts: 67
Re: UDP Sockets
« Reply #3 on: February 21, 2018, 07:54:26 PM »
I am sorry if i was/sounded a little bit impolite, but I missunderstood/did not read carefully your problem.

Actually you do have a limit of sockets which should be 11, afaik.
But why do you need to open 3 different sockets? I mean, you listen on a socket, accept the incoming connection and let the work being done by a thread, so that you can listen to the next incoming connection. And while that you can do you transfering stuff.
Or is there any reason why you want to have 3 different sockets?

Offline kiiwa

  • Sr. Member
  • ****
  • Thank You
  • -Given: 5
  • -Receive: 49
  • Posts: 276
Re: UDP Sockets
« Reply #4 on: March 20, 2018, 05:17:43 PM »
I had my fair share of errors when it comes to sockets on Sunrise, but it's hard to tell from your question, as this might occur for different reasons. Can you elaborate or post the code?
I have some questions, though. At what frequency are you sending/receiving date on your third socket? Do you close the port before reopening it?

Offline LBR_Slave

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 1
  • Posts: 62
Re: UDP Sockets
« Reply #5 on: May 09, 2018, 11:42:26 AM »
Hi kiiwa,
I resolved the problem with this - it turns out I had somehow managed to setup a client-server socket doing a server client type task.. Once I realised this and corrected it (also shed UDP for TCPIP) everything worked like it should. Multi-thread programming on two separate machines communicating via ethernet can very easily lead to confusion, in this case it was intermittent faults as well (the worse kind)..
Best regards