Category : "Java"

Socket Programming in Java

Udp socket programming in Java

Datagram sockets UDP sockets can be used in java with the DatagramSocket class. Server Let code a simple udp server that listens on a certain port number. /** Java ECHO server with UDP sockets example */ import*; import*; public class udp_server { public static void main(String args) { DatagramSocket sock = null; try { //1. creating a server socket, parameter is local port number sock = new DatagramSocket(7777); //buffer to receive incoming data byte buffer = new ...

Java socket programming tutorial

Socket programming in Java This is a quick guide/tutorial to learning socket programming in Java. The Socket class is documented at To summarise the basics, sockets are the fundamental "things" behind any kind of network communications done by your computer. For example when you type in your web browser, it opens a socket and connects to to fetch the page ...

Connect with us