Can you connect a windows server with another windows server using java?

0

How about my problem is the sig. I have to perform a java process that will be hosted on a Windows server (Server 1), this server will run the .jar which has to connect to another server Windows (Server 2) to find a file, read it, extract a fragment of text (this on server 2), hence create a file on server 1 with the fragment that was extracted from the file on server 2.

Is it possible to connect To server 1 with Server 2 using java ?. I did something similar but from windows to Linux opening an SSH connection from java but I do not like it like this.

Someone will have an example of how the connection between both servers would be made. It is what is causing me problems. Thanks again

    
asked by Rodrigo Leonardo Muñoz Torres 30.08.2018 в 23:54
source

2 answers

0

I am not very clear about the whole process, but I can guide you at least to re-direct your search to the place closest to success ...

(Look for using TCP sockets / UDP will not help you for "loss" of data);)

First you need a Server and a client, the server stores the data and returns it to the clients (it also works in reverse), by means of a connection by sockets (you will have something like a "chat") pass any type of data you want (only some more difficult to manage than others) ... loads the file path to the socket and this transfers the data to the other side of the socket, it really is a long issue to leave code but in the following link you will see an implementation of what I'm talking about ... link

    
answered by 06.09.2018 в 04:32
0

If possible and the options are very broad.

Example 1: since server 2 must search and process a file, server 2 could have another Java application to perform this process.

In this case the application could expose a service (REST / SOAP) or a TCP / IP connection with Java Sockets so that the server application 1 calls it asking for the information and giving this the appropriate answer.

Example 2: The server application 1 could access a network folder shared with server 2 as any path to disk access mapped to a unit. This will allow you to search the file itself and process it. It is NOT the most recommended option but it is an option

Example 3: Server 2 can implement some access protocol like FTP / HTTP ... through some integrated server (for example IIS) and server application 1 use some of the multiple Java client libraries that allow access to the server. Server directory 2 through these applications and perform the search and operation

And so we could continue listing multiple examples of possible architectures. The question has a wide variety of answers that depend on how you want to implement the solution.

    
answered by 06.09.2018 в 13:52