Beaglebone Black running client/server using wireless

I’m running the client server example programs from Derek Molloy’s fine book (chapter 10). I’ve put the server on the beaglebone and the client on a separate Linux PC.

Server code:

int main(int argc, char *argv[]){
cout << “Starting EBB Server Example” << endl;
SocketServer server(54321);
cout << “Listening for a connection…” << endl;
server.listen();
string rec = server.receive(1024);
cout << “Received from the client [” << rec << “]” << endl;
string message(“The Server says thanks!”);
cout << “Sending back [” << message << “]” << endl;
server.send(message);
cout << “End of EBB Server Example” << endl;
}

Client Code:

int main(int argc, char *argv[]){
if(argc!=2){
cout << “Incorrect usage: " << endl;
cout << " client server_name” << endl;
return 2;
}
cout << “Starting EBB Client Example” << endl;
SocketClient sc(argv[1], 54321);
sc.connectToServer();
string message(“Hello from the Client”);
cout << “Sending [” << message << “]” << endl;
sc.send(message);
string rec = sc.receive(1024);
cout << “Received [” << rec << “]” << endl;
cout << “End of EBB Client Example” << endl;
}

The examples work great when I plug the BBB directly using the Ethernet port. The client talks to the Ethernet port at 192.168.1.36.

I’ve also setup wireless to work on the BBB using an Edimax dongle. It shows up at 192.168.1.38. If I run the client pointing to the wireless address it doesn’t work.

If I plug the Ethernet cable back into the BBB with the wireless dongle also attached… the wireless address 192.168.1.38 now starts working with the client. The wireless otherwise seems fine. I can ping & wget using just the dongle attached (no Ethernet plugged in).

Any suggestions? Not sure how I would even debug this?

Thanks,

add a wifi dongle to linux pc and try wireless to wireless

When you try the wireless, did you disable the ethernet connection? This
is not just disconnecting it, but also ifdown. Unless you have something
link ifplugd installed the ethernet connection still exists when the cable
is disconnected - it judt does not work. So either install ifplugd or use
ifdown when you disconnect the cable.

David

Thanks for the suggestion. Without the cable connected and I do a ifdown I get:
ifdown: interface eth0 not configured
as there was no inet addr assocatied to eth0.

To reiterate, the wireless works When the cable is connected.

can you show us what "ip route" and "ip addr" show?

David

More info.

This now appears to be just intermittent - as it now works without the cable plugged in - sometimes! I might suspect the wireless dongle or driver but once it works, it seems to continue to work, until I reboot BBB.

wlan0 will always work if I ping or wget.

BTW, I had previously gone through the steps to turn off HDMI and extend the dongle away from the board by using a short extension cord to make sure the Wifi was reliable. This is important for me to get working reliably since I’m doing a proof of concept project for a customer. Perhaps I should look for a different brand dongle.

~Bruce

If you’re using a dongle based on a RealTek chip you might experience intermittent issues. I know that I did. (This also depends on the version of Linux kernel you are using.) I switched to a dongle that uses an Atheros chipset and that works much more reliably.

Thank you for the info. I ordered a dongle from Logic Supply, not sure of the chipset used. I will look into the Atheros chipset as well.

I built the latest kernel for Debian Beaglebone.

As far as I can tell, as long as the dongle acts as a client, it works, but when listening and connecting as a server no such luck - intermittent.

Enter ‘lsmod’ at the command line to see what kernel driver modules got loaded.

Also, you can enter ‘lsusb’ to see the devices detected on the USB port:

user@beagleboneblack:~$ lsusb
Bus 001 Device 002: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
user@beagleboneblack:~$

It becomes very apparent what chipset a device uses.

Keep in mind that many people have good luck with the Realtek dongles. That wasn’t the case for me though.

Thanks for sharing this information. Apparently no luck for me either. Rather frustrating since it appears to work fine with RPi.