Jump to content

Impossible, even for you??

- - - - -

  • Please log in to reply
13 replies to this topic

#1
rickyk586

rickyk586

    Newbie

  • Members
  • Pip
  • 3 posts
Is there any way to establish a TCP connection between two client sockets without one of them being a server?

Task: To establish a connection between two computers.

Requirements:
  • TCP connection (socket)
  • The two computers to be connected cannot listen to ports/accept connections (like a server does).
  • The two computers can however initiate a TCP connection (like a client does)
  • The network path between the two computers cannot be listened to (sniffed).
  • Any number of computers can be used, and these restrictions only apply to the two computers to be connected.

I am 99% sure that this task is impossible, but there are some pretty smart people out there so I may be wrong...

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
One way this has been done with some software is to have a third computer which is a server.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Maurice_Z

Maurice_Z

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts
Well, since there is no Server to listen to ports, you can't get any data, no matter how hard you try, I think... That's how far my logic can take me ^^

#4
rickyk586

rickyk586

    Newbie

  • Members
  • Pip
  • 3 posts
Still no one can answer it??

#5
DuneMan

DuneMan

    Newbie

  • Members
  • Pip
  • 1 posts
trick one I think

#6
R-G

R-G

    Programmer

  • Members
  • PipPipPipPip
  • 142 posts
Well, this issue is elementary (not so hard to do in the practice as it sounds like, or as some other issues theoretically could be), but it is definitely not conveniently.

I could give you a nice introduction on this issues without any problems, but I don't have every minute free time, so I recommend that all people that are interested in this issue try to search for it in a digital search engine. I suggest that you use appropriate parameters, so you will receive pure useful information.
Like an angel without a sense of mercy.

#7
rickyk586

rickyk586

    Newbie

  • Members
  • Pip
  • 3 posts
I would love to hear your answer. I have posted this question on many forums, and have searched the internet many times, and I have concluded that this task is impossible.

The connection requires sync numbers which are randomly generated with each connection, so there is no way to determine what the sync number will be (and there is no way to set the sync number in Java anyways).

#8
hetra

hetra

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 298 posts
  • Location:Australia
  • Programming Language:C, C++, PHP, Python, Delphi/Object Pascal, Assembly
  • Learning:Python, Assembly
Well, maybe a peer model?

Where both computers are both servers and both clients at the same time...

Peer-to-peer - Wikipedia, the free encyclopedia

#9
zoranh

zoranh

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 207 posts
You can't have Berkeley socket connection without one side listening, so your requirements (1) and (2) cannot be both met at the same time.

However, you can have an application protocol (like some of P2P protocols) which doesn't define nodes (computers) as client and server, or master and slave, but rather both can initiate any kind of two-way communication at any given time.

You can imagine chess-playing software which defines two players where each player can initiate an action (make a move). None of them is logically a server. However, physically, one of them must have a server socket in order to create socket connection. It's as simple as that.

For more about Berkeley sockets you may refer to Wikipedia article: Berkeley sockets.

#10
abzero

abzero

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 217 posts
Hmm you guys know the topic is 3 years old.

Anyway, the last constraint in the problem is:
Any number of computers can be used, and these restrictions only apply to the two computers to be connected.

So the answer is....use a third computer which can listen,

#11
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,722 posts
  • Programming Language:C, Java, C++, PHP, Python, Perl, Assembly, Bash, Others
  • Learning:JavaScript
Guys, please try not to resurrect old threads like this, as it pushes more recent ones (with people still paying attention) down the list. R-G, rickyk586 and DuneMan have all left the forum, and Maurice_Z hasn't made a post since February.

And abzero/WingedPanther, you're right, but the problem is that once the computers are connected, they can't communicate because they can't listen. I think. I dunno, that's my interpretation, anyway.
sudo rm -rf /

#12
SweetSixteen <3

SweetSixteen <3

    Newbie

  • Members
  • Pip
  • 4 posts
How about you have both computers listening for the other? That way both can accept connections and act as either client or server. It can be done, just not the way you're putting it.

Asking to do it your way goes against the very designs of the OSI model, the IP protocol, the TCP protocol, and who knows how many other holy texts in between.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users