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: Hello, I have a spring boot server, but it only works on the local host, how can I make it work similarly to p2p without raising the server

  1. #1
    Junior Member
    Join Date
    Apr 2023
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Hello, I have a spring boot server, but it only works on the local host, how can I make it work similarly to p2p without raising the server

    Hello, I am a noob in the field of networks, tell me how can I make it so that two applications (a server on a spring booth) can connect to each other if I have
    access to both devices, but the connection must be via the Internet, I know that most cryptocurrencies work similarly to p2p, I have a discovery, an application -
    a server that will store ip addresses, but I donít know how to write code in java so that both servers can connect to each other, I heard a little about turn, I have an application
    works on REST api, I know a little about sockets. Can you show step by step how to implement it.
    if I run these applications twice on different ports, on the same device, everything works, but how do I make a connection, on
    different devices over the Internet? what ip should i take and from where? I heard about the white ip, but whoever runs it on their PC, give me a simple code.
    example of my code:

  2. #2
    Junior Member
    Join Date
    Oct 2022
    Location
    Pune
    Posts
    24
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Re: Hello, I have a spring boot server, but it only works on the local host, how can I make it work similarly to p2p without raising the server

    To connect two Spring Boot applications over the internet, you can use one of the following methods:

    1. REST API

    This is the simplest way to connect two applications. You can create a REST API in one application and expose it to the internet. The other application can then consume the REST API to communicate with the first application.

    To do this, you will need to:

    Create a Spring Boot application that exposes a REST API.
    Deploy the application to a server that is accessible over the internet.
    In the other Spring Boot application, create a REST client to consume the REST API of the first application.
    Use the REST client to make requests to the REST API of the first application.

Similar Threads

  1. Code that works on Fiddle but doesn't work on local
    By ctincristi in forum Other Programming Languages
    Replies: 4
    Last Post: October 10th, 2014, 05:03 AM
  2. Code that works on Fiddle but doesn't work on local
    By ctincristi in forum Collections and Generics
    Replies: 3
    Last Post: October 10th, 2014, 03:19 AM
  3. Gallery wont load properly on host server
    By camillejb in forum What's Wrong With My Code?
    Replies: 1
    Last Post: June 25th, 2012, 12:54 PM
  4. Replies: 3
    Last Post: May 22nd, 2012, 12:41 PM
  5. Replies: 1
    Last Post: February 19th, 2011, 06:08 PM

Tags for this Thread