It's not a secret anymore!
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 REST with Spring (video course) this week in the Spring 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: 20184

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
It's not a secret anymore!