Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

DatagramSocket question

 
C Munro
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
The syntax to create a UDP connection to a remote address is :
\\ Creates a datagram socket, bound to the specified local
address.
DatagramSocket(int port, InetAddress laddr)
I use the getByName method to get the laddr, however it doesn't seem to want to connect. Can it only be used for local addresses? What do I use for remote addresses, multicast?
Any suggestions would be appreciated?
Thanks
 
C Munro
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi all, okay I realized this was a dumb question after I thought about it for a bit. Since it is a UDP connection , you probably don't connect to a particular address. So do you just use the remote address name in the send and receive commands?
Thanks
 
C Munro
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
okay I answered my own question.
I realized I was trying to make UDP act like TCP.
Once a socket is established to my localhost, I just include the destination ip address in the send and receive methods to get data from a particular destination. I tried to establish two connections, which of course would not work
Thanks for listening!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!