This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes udp sockets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "udp sockets" Watch "udp sockets" New topic

udp sockets

naval joshi

Joined: Jan 05, 2011
Posts: 8

Hello all...
i am creating basic chat application using udp sockets..i want to extend these sockets so that i cn chat with my frnd whose not in lan....can i do so...if yes how??do i need a server...
any information or links please..

scjp 6 , Adobe certified flex developer
Rob Spoor

Joined: Oct 27, 2005
Posts: 19557

naval joshi wrote:so that i cn chat with my frnd

Please UseRealWords: "can" and "friend", not "cn" and "frnd".

DatagramSocket can be used to connect to a specific machine using UDP, but for that you need to know the machine to connect to. Broadcasting is not possible, and that's a good thing - if you were able to broadcast through the Internet, then your broadcast would be sent to everyone across the world!

Please note that UDP is probably not a good idea for a chat client/server pair. UDP messages are not guaranteed to arrive at all, or in the right order. Your entire chat conversation could get messed up, with missing messages and messages arriving at random.

How To Ask Questions How To Answer Questions
naval joshi

Joined: Jan 05, 2011
Posts: 8

thanks for your replyy...
what should i use to make a chat application...for both text and voice chat...
should i use tcp??
or anything else in java...
I agree. Here's the link:
subject: udp sockets
Similar Threads
Voice over UDP Packets
How to distinguish between text and voice data in udp chat .
UDP without IP
Role of Sockets in develpoing a Chat application
Problem in appending multiple names to the textarea