Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8753257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:23:33+00:00 2026-06-13T13:23:33+00:00

Right now I have a Server.java script that is waiting to establish a connection

  • 0

Right now I have a Server.java script that is waiting to establish a connection with a listening port. It is currently running on my Amazon instance.

I also have a Client.java file that is trying to send data to the server that is running locally.

Currently the problem is (and if you know about Amazon cloud you know this) the amazon Ubuntu instance requires a private key to confirm the RSA authentication. Is there someway to do this with the socket? I looked at the constructor and could not find anything to give another argument for the key.

to SSH I have to do this i.e. : ssh -i key.pem root@server.amazonaws.com

Client. java

import java.io.PrintWriter;
import java.net.Socket;

class Client {
    public static void main(String args[]) {
        String data = "toobie ornaught toobie";
        try {
            Socket skt = new Socket("my ubuntu instance", 1235);
            System.out.print("Server has connected!\n");
            PrintWriter out = new PrintWriter(skt.getOutputStream(), true);
            System.out.print("Sending string: '" + data + "'\n");
            out.print(data);
            out.close();
            skt.close();
        } catch (Exception e) {
            System.out.print("Whoops! It didn't work!\n");
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:23:34+00:00Added an answer on June 13, 2026 at 1:23 pm

    You are confused. TCP sockets have nothing to do with ssh (except that ssh does use a TCP socket). RSA keys are needed for SSH. You are just opening a plain TCP socket. The keys and other authentication stuff do not apply.
    What you need to do is allow your port number through the firewall which is automatically running on EC2 instances.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I have a script that will get the last five files in
Right now I have a Java application running WMI querying event logs, this is
Here's my question. Right now I have a Linux server application (written using C++
Right now I have an upload field while uploads files to the server. The
Right now I have a function, in a class that is used to listen
Right now I have a link that causes a hidden div to appear when
Right now I have a foreach loop that grabs the first link with an
Right now I have a PHP file that does a MYSQL query and then
On our development server, we have a bunch of shell script wrappers for Java
Right now I don't have time to optimize and to upgrade servers and once

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.