Solved

Can I open a socket to my own host?

Posted on 1997-11-14
3
189 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
topping2 challenge 13 80
solarwind tftp server 2 44
printing a file in reverse order is easy in recursion rather than in iteration 3 49
Java Timer (static) 9 36
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This video teaches viewers about errors in exception handling.

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now