Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7988227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:22:43+00:00 2026-06-04T12:22:43+00:00

Method 1: InetAddress addr = InetAddress.getByName(192.168.0.101); int port = 18250; Socket socket = new

  • 0

Method 1:

InetAddress addr = InetAddress.getByName("192.168.0.101");
int port = 18250;
Socket socket = new Socket(addr, port);

Method 2:

Socket socket = new Socket("192.168.0.101",18250);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:22:45+00:00Added an answer on June 4, 2026 at 12:22 pm

    They are the same:

    java source code:

    public
    class Socket {
    
    ...
    
        public Socket(String host, int port)
        throws UnknownHostException, IOException
        {
        this(host != null ? new InetSocketAddress(host, port) :
             new InetSocketAddress(InetAddress.getByName(null), port),
             (SocketAddress) null, true);
        }
    
    
        public Socket(InetAddress address, int port) throws IOException {
        this(address != null ? new InetSocketAddress(address, port) : null, 
             (SocketAddress) null, true);
        }
    
    ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The java.net.InetAddress.GetByName(String host) method can only return A records so to lookup other record
Method declaration, -(UILabel *)returnUILabel:(UILabel *)myLabel color:(UIColor *)labelColor x:(int)xParameter y:(int)yParamater width:(int)widthParameter height:(int)heightParameter { CGRect cellFrame
Question: How do I set the canonical hostname as reported by java's InetAddress.getCanonicalHostname() method?
I've created a simple method in attempts to determine if a socket is open
Method alive(port) in RemoteActor does not take IP address as parameter. It constructs internally
Method chaining is the practice of object methods returning the object itself in order
Method keySet() . Examples works fine, but I not sure if I'm right.
Method M takes 2 parameters, P1 and P2. P2 is a delegate. I want
Which method is preferred for adding a row to a table? var tr =
What method would you use to determine if the the bit that represents 2^x

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.