Good! The extension already sends messages online, just run ChatServe.java on a remote server.
Well it is not working for me:
on remote server:
~$ sudo ufw status
Status: active
To Action From
-- ------ ----
12345/tcp ALLOW Anywhere
12345 ALLOW Anywhere
12345/tcp (v6) ALLOW Anywhere (v6)
12345 (v6) ALLOW Anywhere (v6)
~$ java ChatServer
[1] 42130
~$ Server listening on port 12345
when ChatServer running:
~$ ss -lntu
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp LISTEN 0 511 *:80 *:*
tcp LISTEN 0 50 *:12345 *:*
tcp LISTEN 0 511 *:443 *:*
on local computer:
~$ nmap -p 12345 xx.xx.114.189
Starting Nmap 7.80 ( https://nmap.org ) at 2023-11-09 12:57 GMT
Nmap scan report for xx.xx.114.189
Host is up (0.014s latency).
PORT STATE SERVICE
12345/tcp filtered netbus
Nmap done: 1 IP address (1 host up) scanned in 0.25 seconds
~$ nping -p 12345 xx.xx.114.189
Starting Nping 0.7.80 ( https://nmap.org/nping ) at 2023-11-09 12:57 GMT
SENT (0.0013s) Starting TCP Handshake > xx.xx.114.189:12345
SENT (1.0035s) Starting TCP Handshake > xx.xx.114.189:12345
SENT (2.0045s) Starting TCP Handshake > xx.xx.114.189:12345
SENT (3.0057s) Starting TCP Handshake > xx.xx.114.189:12345
SENT (4.0069s) Starting TCP Handshake > xx.xx.114.189:12345
Max rtt: N/A | Min rtt: N/A | Avg rtt: N/A
TCP connection attempts: 5 | Successful connections: 0 | Failed: 5 (100.00%)
Nping done: 1 IP address pinged in 5.01 seconds
I get the same response even if I disable the firewall (ufw)
The ChatServer and port respond successfully if tested locally (on the remote server)
Tomorrow I will connect my server for you to test
When you are running on a remote server, try to explicitly mention the Hostname (of the remote server) when you create the ServerSocket
object. Check the ServerSocket.bind(inetAddress)
method.
ServerSocket server = new ServerSocket();
server.bind(new InetSocketAddress(hostname, port));
My test on remote server:
Yes, I saw that as an option. My server only has an external IP, I serve 6/7 websites from the using Apache. So what IP do I use, the external or the internal/ localhost?
You would need to pass on your server's public IP over to the InetSocketAddress()
I will try it see what gives....
Hmmm, javac doesn't like an IP address (xy.xy.xyx.xyx) either as it is or in quotes. I saw somewhere it needs to be broken down into parts, will seek that out again....
Are you trying to pass it as an argument from command line? Try to explicitly declare it in the code.
Would you like to help implement the key exchange mechanism? Honestly, I don't have the properties for that.
In ChatServer.java
private static final int PORT = 12345;
private static final String hostname = "xy.xy.xyz.xyz";
private static final String KEY = "MySuperSecretKey"; // 16-byte key
private static final String ALGORITHM = "AES";
// Create a thread-safe list to hold all client handlers
private static final List<ClientHandler> clients = new CopyOnWriteArrayList<>();
public static void main(String[] args) throws Exception {
ServerSocket serverSocket = new ServerSocket();
serverSocket.bind(new InetSocketAddress(hostname, PORT));
System.out.println("Server listening on port " + PORT);
From javac:
ChatServer.java:56: error: cannot find symbol
serverSocket.bind(new InetSocketAddress(hostname, PORT));
^
symbol: class InetSocketAddress
location: class ChatServer
1 error
OK, got it to compile, by importing java.net.*
However, still no connection with nping/nmap....
Possibility, I could help you, also maybe I could contribute something to the project
Excellent! Welcome! The GitHub link is in the post GitHub - iagolirapasssos/MITAppInventorchatServerClient: This repository contains the implementation of a secure chat application with server-client architecture, where messages are encrypted and decrypted using symmetric cryptography. Below is a detailed description of how it works, how to use it, security considerations, and future improvements.