• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DatagramSocket question

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
reply
    Bookmark Topic Watch Topic
  • New Topic