The Artima Developer Community
Sponsored Link

Java Answers Forum
Convert String (IP & Port) into InetAddress

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Shaitan

Posts: 11
Nickname: shaitan00
Registered: Feb, 2005

Convert String (IP & Port) into InetAddress Posted: Mar 31, 2005 10:12 PM
Reply to this message Reply
Advertisement
Coding Style: NetBeans IDE 4.0 Beta2 (Java)

Given a string[] array (message[]) that contains an IP-Address (message[1]) and Port# (message[2]).
I need to take the IP-Address and Port# to create an InetAddress (or SocketAddress) object that I can pass to my DatagramPacket

Can I simply do the following:
Convert my IP-Address string into a byte[]
Use the .getByAddress method of the InetAddress object?
If so how do you do the conversion (string -> byte)
Thanks,

Topic: Access VSS database from Linux, Unix, Apple Mac and others? Previous Topic   Next Topic Topic: How to use Perl functions in Java

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use