Solved

Can I open a socket to my own host?

Posted on 1997-11-14
3
208 Views
Last Modified: 2010-04-16
I have a server application that serves communication between different applets. I will call this the exchange application. These applets can connect to my application through a socket and send a message to any other applet connected to this exchange application. This part works.

I would like to be able to access this application not only over the net but from other applications running on the same host. In fact, I have implemented a few (CGI) Java applications that are invoked on the server as a result of an HTTP request. I am trying to create a socket from one of these applications to my exchange application.

However, the socket fails to create. Can I create a socket to the same machine? Otherwise, it may also be possible that my web server (Oracle database web server) does not allow me to create any sockets.

Is there any other way, I might be able to have these two applications communicate other than through a socket?
0
Comment
Question by:stouffs
3 Comments
 
LVL 4

Expert Comment

by:russgold
ID: 1230573
Yes you can open a socket to your own host, as long as you actually download the applet using http:/ protocol, just as though you were on a different machine.  If you use file:/ protocol, the browser will not allow the connection, even though you are connecting to the same machine.

If you are already doing this, can you post a section of code that shows how you are trying to connect and what result you are getting?
0
 

Author Comment

by:stouffs
ID: 1230574
I'm not actually running an applet in this case, instead I'm running a CGI Java application. Thus it's not up to the browser to allow the connection, but up to the web server.

Unfortunately, I'm not getting any result. I catch any Exceptions thrown, but it never gets to this point.
0
 
LVL 4

Accepted Solution

by:
rembo earned 180 total points
ID: 1230575

You can absolutely connect to a socket on from the
host you're on to the host you're on.  Are you
connecting using the same socket calls that you
are using from the client or are you trying to
use localhost?  

It could be a system configuration problem.  If you
post the code, I'd be happy to tell you what's wrong.

Or, you can mail it to me at rembo@cks.com  Or, I could
send you an example where I do it.

-Tony

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
even odd program using while loop 3 60
Windows 10 IE Certificate Issue 10 51
servlet example issue 6 46
mysql jsp example issue 32 51
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This video teaches viewers about errors in exception handling.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question