<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DatagramSocket | Student Projects</title>
	<atom:link href="https://studentprojects.in/tag/datagramsocket/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Fri, 30 Apr 2010 05:46:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>DatagramSocket and DatagramPacket (Client-Server Program using UDP/IP)</title>
		<link>https://studentprojects.in/software-development/java/java-programs/advanced/datagramsocket-and-datagrampacket-client-server-program-using-udpip/</link>
					<comments>https://studentprojects.in/software-development/java/java-programs/advanced/datagramsocket-and-datagrampacket-client-server-program-using-udpip/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Fri, 30 Apr 2010 05:44:20 +0000</pubDate>
				<category><![CDATA[Advanced programs]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[DatagramSocket]]></category>
		<category><![CDATA[DatagramPacket]]></category>
		<category><![CDATA[client server pragramming]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1162</guid>

					<description><![CDATA[<p>Program : DatagramSocket and DatagramPacket (Client-Server Program using UDP/IP) By : Kapil Lohia Program 1 : import java.net.*; class udpip_server { public static DatagramSocket ds; public static byte buffer[]=new byte[1024]; public static void Myserver() throws Exception { int pos=0; while(true) { int c=System.in.read(); switch(c) { case -1: System.out.println("Server quits"); return; case '\r':break; case '\n':ds.send(new DatagramPacket(buffer,pos,InetAddress.getLocalHost(),777));</p>
<p>The post <a href="https://studentprojects.in/software-development/java/java-programs/advanced/datagramsocket-and-datagrampacket-client-server-program-using-udpip/">DatagramSocket and DatagramPacket (Client-Server Program using UDP/IP)</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Program : DatagramSocket and DatagramPacket (Client-Server Program using UDP/IP)<br />
By : Kapil Lohia </p>
<p><strong>Program 1 :</strong></p>
<pre lang="java">

import java.net.*;

class udpip_server
{
	public static DatagramSocket ds;
	public static byte buffer[]=new byte[1024];

	public static void Myserver() throws Exception
	{
		int pos=0;
		while(true)
		{
			int c=System.in.read();
			switch(c)
			{
				case -1: System.out.println("Server quits");
				return;
				case '\r':break;
				case '\n':ds.send(new DatagramPacket(buffer,pos,InetAddress.getLocalHost(),777));
				           pos=0;
				break;
				default:
				buffer[pos++]=(byte) c;
			}
		}
	}

	public static void main(String args[]) throws Exception
	{
		System.out.println("Server ready..\n Please type here");
		ds=new DatagramSocket(888);
		Myserver();
	}
}
</pre>
<p><strong>Program 2:</strong></p>
<pre lang="java">

import java.net.*;

class udpip_client
{
	public static DatagramSocket ds;
	public static byte buffer[]=new byte[1024];

	public static void Myclient() throws Exception
	{
		while(true)
		{
			DatagramPacket p=new DatagramPacket(buffer,buffer.length);
			ds.receive(p);
			System.out.println(new String(p.getData(),0,p.getLength()));
		}
	}

	public static void main(String args[]) throws Exception
	{
		System.out.println("Client - Press CTRL+C to quit");
		ds=new DatagramSocket(777);
		Myclient();
	}
}
</pre><p>The post <a href="https://studentprojects.in/software-development/java/java-programs/advanced/datagramsocket-and-datagrampacket-client-server-program-using-udpip/">DatagramSocket and DatagramPacket (Client-Server Program using UDP/IP)</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/java/java-programs/advanced/datagramsocket-and-datagrampacket-client-server-program-using-udpip/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
	</channel>
</rss>
