Search code examples
javasocketswifi

Java Sockets over WLAN?


I have 2 windows PC's connected over an ad-hoc wlan network.
Using this existing connection can I communicate between these pc's via sockets?
Can I open a server socket on one pc and make the other pc a client and connect to the other pc and then send and receive data over this connection?
Do I need a specific api for this or can I just use java.net.Socket and java.net.ServerSocket?


Solution

  • Of course you can. There is an IP network over the WLAN connection, and nothing stops you from establinshing TCP connection.

    As far as sockets are concerned this is no different to a wired (Ethernet) connection, the difference ends at Data-Link layer