SHOW:
|
|
- or go back to the newest paste.
1 | - | public class Server extends Thread{ |
1 | + | public class Server { |
2 | ||
3 | public static void main(String[] args) throws IOException { | |
4 | ||
5 | //test case flow | |
6 | byte[] sendData = new byte[50]; | |
7 | DatagramSocket sendSock = new DatagramSocket(); | |
8 | ServerSocket socket = new ServerSocket(57111); | |
9 | sendData = "server msg here".getBytes("UTF-8"); | |
10 | sendSock.connect(InetAddress.getByName("10.0.2.15"), 57111); | |
11 | DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length,InetAddress.getByName("10.0.2.15"), 57111); | |
12 | sendSock.send(sendPacket); | |
13 | System.out.println("pack sent"); | |
14 | ||
15 | } | |
16 | } |