February 2014
Beginner
1248 pages
62h 25m
English
After displaying a packet, line 60 calls method sendPacketToClient (declared at lines 71–83) to create a new packet and send it to the client. Lines 77–79 create a DatagramPacket and pass four arguments to its constructor. The first argument specifies the byte array to send. The second argument specifies the number of bytes to send. The third argument specifies the client computer’s IP address, to which the packet will be sent. The fourth argument specifies the port where the client is waiting to receive packets. Line 81 sends the packet over the network. Method send of DatagramSocket throws an IOException if an error occurs while sending a packet.
Read now
Unlock full access