UDP server java source code
#1

Code:
// writing client server program using UDP

import java.net.*;
import java.io.*;


class UDPserver
{
    final static int ECHO_PORT=7;
    public static void main(String args[])
    {
        DatagramSocket ds;
        DatagramPacket dp;
        
        try{
               ds=new DatagramSocket(ECHO_PORT);
               while(true){
                dp=new DatagramPacket(new byte[1024],1024);
                ds.receive(dp);
                dp=new DatagramPacket(dp.getData(),        
                    dp.getLength(),dp.getAddress(),dp.getPort());
                ds.send(dp);
            }
        }catch(IOException e){
            System.out.println("could not recieve or send data");
         }
     }
}
Reply
#2
import java.net.*;
import java.io.*;


class UDPserver
{
final static int ECHO_PORT=7;
public static void main(String args[])
{
DatagramSocket ds;
DatagramPacket dp;

try{
ds=new DatagramSocket(ECHO_PORT);
while(true){
dp=new DatagramPacket(new byte[1024],1024);
ds.receive(dp);
dp=new DatagramPacket(dp.getData(),
dp.getLength(),dp.getAddress(),dp.getPort());
ds.send(dp);
}
}catch(IOException e){
System.out.println("could not recieve or send data");
}
}
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: short note on tcp and udp session hijacking in network security, seminar o n udp protocal, difference between tcp session hijacking and udp session hijacking, tcp and udp file type ppt, show tcp udp autotuning, difference between tcp and udp, enc28j60 udp avr,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  Simple Key Events Java source code smart paper boy 3 3,595 07-02-2017, 03:41 PM
Last Post: NARESHLAFOOT
  Window Events Java source code smart paper boy 1 3,673 02-03-2012, 10:48 AM
Last Post: seminar paper
  Inter net banking java source code smart paper boy 3 5,947 01-03-2012, 11:24 AM
Last Post: seminar paper
  UDP client Java source code smart paper boy 2 3,675 12-12-2011, 09:56 AM
Last Post: seminar addict
  Text Demo Java source code smart paper boy 0 2,076 30-08-2011, 12:44 PM
Last Post: smart paper boy
  Text Area Demo Java source code smart paper boy 0 2,083 30-08-2011, 12:44 PM
Last Post: smart paper boy
  Servlet Database Java source code smart paper boy 0 2,457 30-08-2011, 12:42 PM
Last Post: smart paper boy
  server test Java source code smart paper boy 0 2,261 30-08-2011, 12:42 PM
Last Post: smart paper boy
  Ser To App java source code smart paper boy 0 1,677 30-08-2011, 12:39 PM
Last Post: smart paper boy
  SB Demo java source code smart paper boy 0 1,538 30-08-2011, 12:38 PM
Last Post: smart paper boy

Forum Jump: