Jul 14

By default a new virtual machine will only be accessible from the host machine. To make it available to the network you need to go into the Network sessings for the virtial machine and select Bridged (instead of NAT).

"Connect directly to a physical network (bridged)"

written by objects \\ tags: , , , ,

Jan 25

To listener for an incoming network connection you need to use a ServerSocket as shown in the following example.

// Create the listening server socket

int port = 999;
ServerSocket ssocket = new ServerSocket(port);
// Listen for SSL connections
// This call will block until a connection is received

Socket socket = ssocket.accept();

// Treat the connection as you would any socket

If you want to listen for multiple connections then you can call accept() inside a loop and (typically) create a new Thread to handle each connection. By passing off handling to a new thread you allow accept() to accept new connections.

while (listener) {
    Socket socket = ssocket.accept();

    // create a new thread to handle socket communication

written by objects \\ tags: , ,