Java Language Tutorial:

Java Language Networking

Syntax

  • new Socket("localhost", 1234); //Connects to a server at address "localhost" and port 1234
  • new SocketServer("localhost", 1234); //Creates a socket server that can listen for new sockets at address localhost and port 1234
  • socketServer.accept(); //Accepts a new Socket object which can be used to communicate with the client

Java Language Networking Examples:

Related Java Language Tutorial Topics:

Other Tutorial Topics:

This modified content is an extract of the original Stack Overflow Documentation released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow. This topic was created and modified by the Stack Ovedrflow Contributor.