TCP Socket Connection:EV3 Client<->PC Server

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

TCP Socket Connection:EV3 Client<->PC Server

Postby AlanG » Mon Jun 23, 2014 7:40 pm

I would like to create a TCP Client/Server connection between an EV3 and a PC using leJOS 0.8.1beta and the java.net classes of Java SE7.

Thanks to my wpa_supplicant.conf file, my EV3 boots up and associates itself with whichever of my commonly-used access points is closest. The local DHCP server routinely assigns the EV3 a "192.168" IP address. But the EV3's /proc/net/wireless file remains empty. So, I don't see how Embedded Java 7u60 and the LocalWiFiDevice and WiFi classes can help me set up an instance of java.net.Socket on the EV3.

Is this possible, using 0.8.1beta? Do you have some example jeJOS code that accomplishes this?

Thanks
AlanG
New User
 
Posts: 15
Joined: Wed May 21, 2014 10:02 pm

Re: TCP Socket Connection:EV3 Client<->PC Server

Postby gloomyandy » Mon Jun 23, 2014 8:26 pm

What makes you think you need to use the LocalWiFiDevice class? What do the contents of /proc/net/wireless have to do with anything? What is the problem that you think you have? You can use the standard Java classes to create sockets etc. with no problems. You don't need any "leJOS code" to do this it is all just standard Java, have you tried it? What happens, what problems do you have? There are lots of examples on the web for how to create TCP/IP based applications in Java.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4081
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: TCP Socket Connection:EV3 Client<->PC Server

Postby AlanG » Mon Jun 23, 2014 8:40 pm

Are you suggesting that I need only invoke a Socket constructor with a remote port number and either host name or IP address, with the expectation that Linux and ejre 7u60 handle this transparently? That would be great, if it's just that easy!

I thought that I might have to use leJOS to create a SocketImpl, somehow involving an interface defined in that file that your WiFi.java code reads, namely /proc/net/wireless.
AlanG
New User
 
Posts: 15
Joined: Wed May 21, 2014 10:02 pm

Re: TCP Socket Connection:EV3 Client<->PC Server

Postby gloomyandy » Mon Jun 23, 2014 8:57 pm

Why not try it, you might be pleasantly surprised. So long as the menu screen is showing the WiFi IP address of your EV3 (in addition to 10.0.1.1) then you should be good to go. If the menu is not showing the address then there may be some sort of problem with your network setup.
User avatar
gloomyandy
leJOS Team Member
 
Posts: 4081
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: TCP Socket Connection:EV3 Client<->PC Server

Postby AlanG » Mon Jun 23, 2014 9:05 pm

My EV3's boot-up with immediate automatic connection to the nearest known access point is extreme reliable now. I love pleasant surprises, so I will give your suggestion a try, and let you know the results!
AlanG
New User
 
Posts: 15
Joined: Wed May 21, 2014 10:02 pm


Return to EV3 Software

Who is online

Users browsing this forum: No registered users and 1 guest

cron
more stuff