I have some problems with my server socket. I create a DatagramSocket to chat between a server and a client.
public static void main (String[] args) throws IOException {
        byte[] send = new byte[1024];
        byte[] receive = new byte[1024];
        BufferedReader entree;
        DatagramSocket serverSocket = null;
        InetAddress ip;
        InetAddress ipDest;
        int port;
        try {
            serverSocket = new DatagramSocket(8888);
        } catch (SocketException e) {
            e.printStackTrace();
        }
        while (true) {
            DatagramPacket recu = new DatagramPacket(receive, receive.length);
            serverSocket.receive(recu);
            String sentence = new String(recu.getData());
            ipDest = recu.getAddress();
            port = recu.getPort();
            System.out.println("Reçu:"+sentence);
            entree = new BufferedReader(new InputStreamReader(System.in));
            String chaine = entree.readLine();
            send = chaine.getBytes();
            DatagramPacket dp = new DatagramPacket(send, send.length, ipDest, port); 
            serverSocket.send(dp);
            send = new byte[1024];
            receive = new byte[1024];
        }
But I use new BufferedReader(new InputStreamReader(System.in)) get the next stuff to send, and it is blocking. So, I cannot receive what's comming from the client and print it.
How can I arrange this ?
Merci, eo