Is it possible to create a WiFi TCP socket between two computers in a LAN?

1

Here is our setup.

The documentation says that:

This allows for real "Socket" connection over WiFi...

and

... [the Wifi module] is a complete IEEE 802.11bgn WiFi client device

We have succeeded at the following:

  1. Connect the Wifi module to our home wireless network.
  2. Make an HttpWebRequest to an arbitrary Internet server.
  3. Open a socket to an arbitrary Internet server and receive data.

What we want to do now is to open a TCP socket to our Desktop Computer (ASUS A55A with a standard setup). Here are two options:

  • Connect the Cobra and the PC via the Internet (WAN). This seems like overkill.
  • Connect the Cobra and the PC via the Intranet (LAN). This seem preferable.

That's the question. How do we create a LAN between the Cobra and the PC? Here are some sub-questions:

  • Does this entail turning the Cobra into an Ad-Hoc Host?
  • Is the router required?
  • Or, can we circumvent the router and communicate directly between the Cobra and PC?

Diagram of the Goal

Application on Cobra II
   |
   |
   |
Wifi Module in Cobra II
   |
   |
   |
Wireless TCP Socket
   |
   |
   |
Router 
(required?)
   |
   |
   |
Wireless TCP Socket
   |
   |
   |
Wireless Card in Desktop Computer
   |
   |
   |
Application on Desktop

Shaun Luttin

Posted 2014-01-24T01:46:08.937

Reputation: 1 911

Answers

2

If two computers are going to communicate via Wifi without an access point, they need to be in ad-hoc or IBSS mode.

If you literally want to create a LAN, you will need a wireless bridge capable of running in AP mode. A typical consumer router does this, and also bridges the wireless interface to the wired, so it all is on the same network.


Consumer-level wireless routers are a couple devices in one:

  • a router
  • a wireless bridge that can work in AP mode
  • a wired switch

You don't need the first component of this. As long as you don't connect anything to the WAN port of the router, you ought not to be bothered by the actual routing functionality.

LawrenceC

Posted 2014-01-24T01:46:08.937

Reputation: 63 487

Don't forget they also function as a DHCP server, and a caching DNS server. – Bob – 2014-01-24T02:27:16.447

Then use ad-hoc or IBSS mode. Looking at the link you provided for your module, it seems to be supported. – LawrenceC – 2014-01-24T02:34:09.837

Based on your answer it seems that yes, it is possible to create a WiFi TCP Socket between two computers, but that this will not be a real LAN. Also, it entails turning the Cobra II Wifi Module into an ad-hoc host, and that this is equivalent to IBSS mode. We can circumvent the router and communicate directly between the Cobra and the PC. The answer then is to create a WiFi TCP Socket between the Cobra and the PC by setting the Wifi module to ad-hoc mode. – Shaun Luttin – 2014-01-24T02:37:08.113

See also How 802.11 Wireless Works

– Shaun Luttin – 2014-01-24T02:43:18.883