Connecting to a Server on a Server

D

deadpickle

I have a chat client that needs to connect to a chat server in order
to function. This is for research use so I have access to an academic
server named Updraft. For this research, Updraft acts as a central
point where all data is accumulated. It would be real nice if I could
have all the chat client connect to the chat server that resides on
Updraft. I problem I see here is that Updraft uses SSH and the chat
clients use IO::Socket::INET. That means that first a user would have
to login to Updraft using SSH then the client program creates a socket
using IO::Socket::INET. That seems a bit strange. I'm looking for
ideas on how to resolve this issue. Is it even possible for this to
work?
 
X

xhoster

deadpickle said:
I have a chat client that needs to connect to a chat server in order
to function. This is for research use so I have access to an academic
server named Updraft. For this research, Updraft acts as a central
point where all data is accumulated. It would be real nice if I could
have all the chat client connect to the chat server that resides on
Updraft. I problem I see here is that Updraft uses SSH

Updraft probably uses hundreds of things, one of which is SSH. Just
because the server has an sshd running, doesn't mean you have to use SSH
for your task.
and the chat
clients use IO::Socket::INET. That means that first a user would have
to login to Updraft using SSH then the client program creates a socket
using IO::Socket::INET.

Why can't they just use IO::Socket::INET to connect to Updraft from where
ever they happen to be logged in already? That is what INET is for, so you
don't have to be logged into the same machine. I do this all the time.
Many server-machines won't let me do a system-level login using anything
other than SSH, but they are happy to let me make ordinary (non-login)
connections with IO::Socket::INET.
That seems a bit strange. I'm looking for
ideas on how to resolve this issue. Is it even possible for this to
work?

I'm not sure what the issue even is, or what the "this" is that may or may
not work. If you want to use IO::Socket::INET, use it. If once you try to
use it, it fails, then we would need to know why it fails--what kind of
errors you are getting. When describing a problem, "Doesn't work" doesn't
work.

Xho

--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
 
D

deadpickle

I ran a simple test and it did seem to connect to the server since it
returned a value for the socket instead of an undefined value. I found
out what the public port is for the Updraft server and that let me
through (I think). But now I have ran into another issue with the chat
server that is ran from inside Updraft. When I change the port to 80,
the same public port, I get the error "Can't call method "accept" on
undefined variable" that comes from the created socket that is
listening to the public port. When I change the port value to another
port, say 12345, it works just fine. I'm not familiar with how servers
work, and was wondering if forwarding another port on Updraft,
specifically for the chat server, would resolve this and make it so
that only the chat server with listen on this specific port for chat
clients?
 
B

Ben Morrow

Quoth deadpickle said:
I have a chat client that needs to connect to a chat server in order
to function. This is for research use so I have access to an academic
server named Updraft. For this research, Updraft acts as a central
point where all data is accumulated. It would be real nice if I could
have all the chat client connect to the chat server that resides on
Updraft. I problem I see here is that Updraft uses SSH and the chat
clients use IO::Socket::INET. That means that first a user would have
to login to Updraft using SSH then the client program creates a socket
using IO::Socket::INET. That seems a bit strange. I'm looking for
ideas on how to resolve this issue. Is it even possible for this to
work?

If what you mean is that updraft is firewalled, and the only way in is
via a ssh tunnel, then you may be able to use Net::SSH2 to create a
tunneled connection. See the ->tcpip method of Net::SSH2. Note that this
requires that updraft supports ssh2, and also requires libssh2 installed
on the client.

Net::SSH2 has a lot of FAIL reports from CPAN testers, but most of these
seem to be because libssh2 isn't installed. They should really be NA
reports: unfortunately, getting a Makefile.PL to produce an NA report is
not terribly well documented, so lots of people seem to get it wrong.

Ben
 
D

deadpickle

If what you mean is that updraft is firewalled, and the only way in is
via a ssh tunnel, then you may be able to use Net::SSH2 to create a
tunneled connection. See the ->tcpip method of Net::SSH2. Note that this
requires that updraft supports ssh2, and also requires libssh2 installed
on the client.

Net::SSH2 has a lot of FAIL reports from CPAN testers, but most of these
seem to be because libssh2 isn't installed. They should really be NA
reports: unfortunately, getting a Makefile.PL to produce an NA report is
not terribly well documented, so lots of people seem to get it wrong.

Ben

So then if this works do I still need to create a socket using
IO::Socket::INET on the client as well as the server or can I proceed
in the script without creating the IO::Socket:INET?
 
B

Ben Morrow

Quoth deadpickle said:
So then if this works do I still need to create a socket using
IO::Socket::INET on the client as well as the server or can I proceed
in the script without creating the IO::Socket:INET?

Read the docs. ->tcpip returns (something equivalent to) a filehandle,
that you use as you would use a socket: that is, you don't need to
create a separate socket. This is one advantage over using an external
ssh client: if you were, you *would* need to create a separate socket
connection to the local end of the tunnel.

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top