Solved

Sockets connection....

Posted on 1998-03-16
1
229 Views
Last Modified: 2010-04-16
Is it possible to open a socket connection and using that
open connection to connect to another server??
The problem is that there is a server  'A' that I need to connect to but I can only do so if I first connect to another server 'B' and to connect to server 'A' from there.
0
Comment
Question by:ABC031698
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
jpk041897 earned 150 total points
ID: 1233614
Generaly speaking, uou can set up a bridge using two sockets, but you cannot use the same socket to connect three boxes.

In practice, you could set up a packet switching network on server B, that redirects its input to A, but this implies spetial software, admin leve control over server B and is usualy either more expensive or more trouble than its worth.

A socket is a data stucture that contains information regarding an open connection betwwen to machines. As such it will contain information suc as port numner (SSMTP, FTP, etc), IP address of the desired connection (which is resoveld via DNS resolution from the URL), status, etc.

Contrary to first impretions though, a socket is not, in itself an active connection.

When you open a socket, you are requesting two computers to establish a connection via TCP, UDP or X.25 and to fill in the data structures. The connection itself though is handled by the TCP, UDP or X.25 stack (Winsock for example) and is written over a point to point architecture.

To sum up, if you are the admin, Super user or whatever for server B and can afford to set up server B as a packet swithing net without affecting other software, then you can solve your problem with minimal programming effort. If on the other hand you don't meet these requirenments then  you can set up a bridge as follows (a bridge is a read and forward mechanism).

Set up a listener on Server B, whenever a socket is opend, in B, it can open a client conection to Server A using another socket (it can use the same port, it just has to be a difrent data structure, aka socket). The server app in A can then have a listener that awaits data from B, execute whatever is required from it and then reverse the process back to the original client.
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
swing controls 2 38
spring maven example issues 3 106
Hibernate Inheritance Strategy for Abstract Base class and two concrete classes 3 39
Session in java desktop 5 38
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

751 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