Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Expose the server socket outside

  1. #1
    Junior Member
    Join Date
    Nov 2020
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Expose the server socket outside

    Hi,

    recently I became interested in the topic of Sockets in Java. I came across the official documentation:
    docs.oracle.com/javase/tutorial/networking/sockets/index.html

    I have two simple sockets here - the EchoServer server and the EchoClient client. The principle of their operation is trivial - the client sends some text to the server, and then the server sends back the same message (I personally modify this message delicately to make sure that the server actually processed it). Locally everything works fine, but I started to wonder how can I expose my socket to the local network or to the whole world at all? So that, for example, my friend from another part of country could send a message to the server and the server could reply to him? I searched the web for "How to deploy java server socket?" and so on, but I can't find anything about it. I would be grateful for any tips.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,162
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Expose the server socket outside

    how can I expose my socket ... to the whole world
    I think that requires a configuration change in your router so that it will know which local address to send incoming messages to.
    Then get your IP address on the internet and give that to who you want to be able to connect to your server.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. TCP Java Socket Server
    By vviston in forum Java Networking
    Replies: 3
    Last Post: March 24th, 2014, 05:36 AM
  2. Re: Java socket server problem
    By viperhastle in forum Java Networking
    Replies: 1
    Last Post: May 27th, 2012, 11:21 AM
  3. Sending zip from server socket
    By moon_werewolf in forum Java Theory & Questions
    Replies: 0
    Last Post: May 30th, 2011, 07:51 AM
  4. Problem reading from server socket
    By glauber in forum Java Networking
    Replies: 0
    Last Post: February 15th, 2011, 12:54 PM
  5. client/server socket
    By Java_dude_101 in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: January 18th, 2011, 01:16 AM