ings
Member level 4
hello plz if i want to se TCP protocol can you please give me the program java of TCPyes, you don't need a second RN171
you can connect to your local Wireless network and run a server on a PC to receive data, e.g. the code the UDP server
Code:// simple UDP server waiting for datagrams and extracting a string import java.io.*; import java.util.*; import java.net.*; public class UDPserver extends Thread { public static void main(String args[]) { int receivePort=999; // port to receive datagrams from InetAddress remoteIPaddress; // IP address of remote host int remotePort; // port on remote host to send frames too byte[] buffer = new byte[65507]; // array to put datagrams in DatagramPacket dp = new DatagramPacket(buffer, buffer.length); // create packet for datagrams try { // open DatagramSocket to receive and a DatagramePacket to hold the datagrams DatagramSocket ds = new DatagramSocket(receivePort); // loop forever reading datagrams from the DatagramSocket while (true) { ds.receive(dp); // wait for next datagram byte[] data = dp.getData(); // get datagram contents String s = new String(data, 0, dp.getLength()); // create a string from the data System.out.println("\nFrom IP " + dp.getAddress() + " UDP string received " + s + "\n"); } } catch (IOException se) {System.err.println("error " + se);} System.exit(1); // exit on failure } }
thanks in advance