Ssh client to telnet Server JAVA - java

I have telnet server and telnet client and i am making requests and responses.
Now instead of telnet client i need to use SSH client. For the ssh client I am using Jsch. I am trying to connect my client to the telnet server but I have errors.
So my question is: Is it possible to connect SSH client to telnet server and to make requests and responses.

No, this is not possible as telnet and ssh are different protocols.

Related

Java socket client port forwarding

I'm currently coding a client-server java application. I use the java socket api for sending data from the client to the server and vice-versa.
The server is running on windows on port 9001.
The client is in a docker container on the same machine.
What port do I have to bind in docker so that the client in the docker container can connect to the server?
I've tried binding the server port, which obviously didn't work because it's already taken by the server.
The client needs to connect to the host on port 9001.
The common way to do that is to add the host-gateway as an extra host by adding --add-host=host.docker.internal:host-gateway as a parameter to your docker run command.
Then the client can connect to your server program using host.docker.internal as the hostname (and 9001 as the port name).
Connect to the server's IP:9001. What won't work is if you try to connect to localhost, as from inside the docker container it would look like connecting to the same container.
Of course your server process needs to listen to IP:9001, and listening to localhost:9001 is not sufficient.
Regarding binding: The server opens a port for listening, and that is called binding. The client opens a port for sending (but this sending port address is taken from the ephemeral port range and thus irrelevant) and uses that port to connect to the server port.
See also:
https://docs.docker.com/network/
https://docs.docker.com/network/host/
https://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html

Client-Server Chat application JAVA

I have a simple java written client and server chat application(with sockets). When running on the same network/computer it works fine. However when i try to run the client from a different network it doesn't connect. I tried using the public IP address of the server to connect the client to the server but without luck. How would I be able to connect to the server app from a different network? any help would be appreciated.
It sounds like you have more of a firewall issue than a problem with the application. Instead of trying to connect with the Java client, first try connecting with Telnet to the server from the same computer, then from the other computer. The first effort will show you what to expect when it works. For instance, if your server is running on port 999, use telnet server.example.com 999.
If the machines are Linux boxes, use iptables -L to see whether there is a block on the port you are trying to access.
If you're still having problems reaching the server, run tcpdump -i tcp:999 on the server host to see what traffic is making it to your server socket, then run the telnet commands again. You should see the tcp connection established when connecting from the local machine, maybe or maybe not when connecting from other machines. If you don't see it while connecting from other machines, run tcpdump there too to make sure the client is definitely sending the traffic to the server.
After you are sure that the server can receive traffic and that your client is sending the traffic, there are no mysteries about what is actually going on and you should find your problem.
It worked after I did port forwarding on router. Most of the ISP provided modem/routers wont let you manipulate ports so had to buy my own modem/router, forwarded the port and worked like a charm. Information on what port forwarding is can be found here : http://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/

Can you let a proxy between Client and Server change the Client´s Ip Adress

I have a Client and a Server Application. Between the Client and the Server I have a Proxy.
When the Client opens the Socket with new Socket(ip,port) it is supposed to connect to the Proxy. It is doing that without any Problem.
Now I want the Proxy to connect to the Server, but the Server is supposed to think, that it is the Client which connects to him.
Any ideas on how I can do that?
Well, it depends on how you are connecting to the server. Is it just a plain socket? If so, it will be hard, at least via normal Socket API, at the end the Proxy is who is connecting to the server...
IF you are accepting http requests, then, depending on the proxy server, you will probably get a header X-Forwarded-For which will have the real IP Address that connected to the proxy.

How to create a simple pop3 email server?

The server has to handle requests from a pop3 client. I was able to create an smtp email server, which can handle Telnet communication.
For the pop3 server, I have to support a pop3 client (any one). I tried Thunderbird, but I don't know what kind of stream is coming from the Thunderbird and how to properly handle the communication between the server and the pop3 client.
I could use any pop3 client and the server doesn't have to handle encryption. I just need something that is simple and works.

Java wrap server ssh tunnel

I have a simple server Java app that listens on a port, processes commands and replies.
I would like to make it behave like an ssh server, so that clients connect as if by ssh and all comms are forwarded to my app. This sounds like it could easily be done via ssh port forwarding, but my attempts have failed.
The client of your app would do:
> ssh -L1234:localhost:1234 your.host.com
Where 1234 is the port you are listening on. Then clients' connecting to localhost:1234 will be forwarded to your app via SSH

Categories