Create a server socket from an existing client socket

Hi.
I'm using a TTcpClient component to connect to a server (i know the component is deprecated...)

The delphi (windows 32 vcl) application is a client socket (connected to an as400 server socket)

I need to create a second socket in the delphi application that is a server socket (to implement the drawback design pattern)

So i need to create a new connection between the same job on the as400 and the same process in the delphi application, but reversed. (the windows application is this time the server)

I can't use the ip adress of the windows desktop to initiate the connection from the as400, because the application on the windows desktop can run on a tse architecture.

Is it possible to use the first connection to create the new one ?
0
duval
12/31/2013 2:03:02 PM
embarcadero.delphi.win32 2183 articles. 0 followers. Follow

4 Replies
2308 Views

Similar Articles

[PageSpeed] 23
Get it on Google Play
Get it on Apple App Store

duval wrote:

> So i need to create a new connection between the same job on the as400
> and the same process in the delphi application, but reversed. (the
> windows application is this time the server)

The as400 needs to create a new client socket and connect it to your new 
server socket.

> Is it possible to use the first connection to create the new one ?

No, it is not.  That is not how TCP/IP or sockets are designed to work.  
Each connection is unique and independant from other connections.  Are you 
SURE you actually need a server socket?  What is the actual requirement that 
the "drawback design pattern" needs?

--
Remy Lebeau (TeamB)
-1
Remy
12/31/2013 4:55:05 PM
hi. Sorry i meant "callback design pattern" 

I want to make a "push server" instead of a "pull client".

Sometimes i want the server to be able to trigger an event on the client.(when a long thread is done for example)

Another solution than a socket could suit me but i thought i could reuse the first one .

I know i will have to create a new socket from the as400, and i know the ip adress of the client that is gonna become a server, but what if the client runs on a tse ? Don't they all seen from the same ip adress ?



> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> duval wrote:
> 
> > So i need to create a new connection between the same job on the as400
> > and the same process in the delphi application, but reversed. (the
> > windows application is this time the server)
> 
> The as400 needs to create a new client socket and connect it to your new 
> server socket.
> 
> > Is it possible to use the first connection to create the new one ?
> 
> No, it is not.  That is not how TCP/IP or sockets are designed to work.  
> Each connection is unique and independant from other connections.  Are you 
> SURE you actually need a server socket?  What is the actual requirement that 
> the "drawback design pattern" needs?
> 
> --
> Remy Lebeau (TeamB)

Edited by: duval arnaud on Dec 31, 2013 2:07 PM

Edited by: duval arnaud on Dec 31, 2013 2:09 PM
1
duval
12/31/2013 10:11:42 PM
duval wrote:

> I want to make a "push server" instead of a "pull client".

TCP is bidirectional.  Once a socket connection has been established, data 
can flow in both directions at any time.  You do not need to open a server 
socket in order to receive pushed data.  A client socket can connect to a 
server socket and then the server app can push data to the client app.

--
Remy Lebeau (TeamB)
0
Remy
1/1/2014 5:32:58 PM
ok thanks.


> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> duval wrote:
> 
> > I want to make a "push server" instead of a "pull client".
> 
> TCP is bidirectional.  Once a socket connection has been established, data 
> can flow in both directions at any time.  You do not need to open a server 
> socket in order to receive pushed data.  A client socket can connect to a 
> server socket and then the server app can push data to the client app.
> 
> --
> Remy Lebeau (TeamB)
0
duval
1/3/2014 9:53:50 AM
Reply:

Similar Artilces:

Anyone using Delphi clients with Python socket servers?
Hi, Just wondering if anyone is using Delphi clients (indy or synapse) with Python based servers using threads or select from a single process. I have been playing around with Python as the server because its fairly similar to Delphi and runs on every OS. I have made a CRLF based server and a Synapse based client for sending and receiving popup notifications. So far the combo is great, but I am really wondering if anyone has done anything with sending streams(files or other binary data) from delphi to a Python server and how it was handled. -- Tony Caduto AM Software Design http:/...

client-server with socket
--gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable i have got the multithreaded server example from perldoc but i need a client that will connect, and upon recieving a certain work from the server, send some authentication details and the current ip address of the client. this is for a dynamic dns solution. I need to have the client send and recieve info to and from the server, but there don't seem to be any examples of this 2-way conversation. --=20 Mat Harris OpenGPG Public Key ID: C37D5...

socket, client, server problem
  i use socket to link client and server together.the server is in console side, while the client is using asp.net to establish a webpage using c#. there is a button, textbox in the page, i want to type some words in the textbox, when i click the button, i can send the string that i previously typed to the server through socket. 1 using System;2 using System.Data;3 using System.Configuration;4 using System.Web;5 using System.Web.Security;6 using System.Web.UI;7 using System.Web.UI.WebControls;8 using System.Web.UI.WebControls.WebParts;9 using Syst...

Re: client-server with socket (fwd)
---------- Forwarded message ---------- Date: Thu, 26 Sep 2002 11:34:46 +0530 (IST) From: Sudarshan Raghavan <sraghav@india.hp.com> To: Mat Harris <mat.harris@genestate.com> Subject: Re: client-server with socket On Tue, 24 Sep 2002, Mat Harris wrote: > sorry, i have not made myself clear and the many typos won't have helped > either. I need both ends of the connection to be able to read and write > data. I will outline the process here: > > 1) user runs client using config file containing username/passwd/domainname > 2) client connects to ...

Creating a .net chat server with Sockets
If I create a .net chat server with Sockets, then the socket has to be "listening" for incomming connections. Well, do I have to create it as an .exe or can I create it as a .dll? The reason I ask is because I want this to be "host independant", meaning that I want to be able to distribute it to my clients whether they host their own websites or not. I dont want to have to call some hosting company to "start" the chat server. I want to be able to automatically start it. Would I be able to initialize it through an ASP.NEt page or something? I've created .Exe...

simple socket server/client architecture
Hi, I am implementing a simple server/client architecture using sockets. I wonder if anyone is having some pointers on good literature about this (I find a lot of it, all over the place, but not much thats really good, I think). I'm thinking, on the server side, to have one listening thread (a 'message box' thread). As the thread receive a message, a complete message is pushed on to a message queue on the server. Another thread is processing messages in the queue. I wonder, is it customary to have a blocking socket in the 'message' box? On the client side, ...

Perl Socket Client for C++ Server
Hi there, i have written a socket c++ server, which listens for clients and understands some commands. here the structs of the server commands: enum command { SET_PRIO, CLEAR, SEND_STRING, SET_CURSOR, SHOW_CURSOR }; struct string_packet_t { char str[DATA_LENGTH]; }; struct int_packet_t { int data; }; struct cmd_packet_t { command type; union { int_packet_t int_pkg; string_packet_t str_pkg; }; }; a c++ client would now send following command over the socket to t...

More Bidirectional Sockets w/ Win32 Client
I have figured out how to set up bidirectional communication through sockets by forking the server and the client - The client forks just fine under Linux, but if I take the script to Win32 fork doesn't seem to work. This is the code for both the server and client: Here's the server: #!/usr/bin/perl use IO::Socket; $SIG{CHLD} = sub {wait ()}; $main_sock = new IO::Socket::INET (LocalHost => 'shell', LocalPort => 1200, Listen => 5, P...

Wanted: Example of asynchronous bidirectional socket client (a socket chat program)
Sorry if this appears twice. Since it bounced back to me -- probably=0Abeca= use of the HTML format -- I'm sending it again.=0A=0AI did some google sear= ching and I could not find an example of a=0Abidirectional asynchronous soc= ket client. A telnet client is an example=0Aof a bidirectional asynchronous= socket client.=0A=0AI don't specifically want source to a telnet client --= that would be=0Amuch fancier than what I require and would not be helpful = if the perl=0Aonly called C++. I just want an example in pure perl (or ruby= or=0Apython).=0A=0A=0ABy asynchronous I mean ...

Problem with sendind data through socket client/server
I created a server and client , I'm sending a text file between them. The client read data from a text file and send it to the server, then the server create the file again, When i test it on my computer everything was ok,But when i separate the server and client from the same computer (i put the server in other country) when the server create the file he received i noticed its not the same size, Now the file is bigger ,he has more byte and has duplicated rows, What can i do?? im using : tcpClient NetworkStream ...

using socket server with asp.net client
Hi I am new to socket programming in .Net... I've just developed a Async Socket Server (console based c# Application)... this server will look for updates in the database and if there exists some updates it will notify to the connected clients.... Now wot i want is... my asp.net application is connected to local IIS and i want to use this server as a gateway b/w IIS and clients(asp.net)... i.e., this server will only notify asynchronously to the clients and clients will get the updated version of data from DB Server... can anyone plzzz guide me in this case Regards ...

Socket configuration settings for single process client server
Hi All!!! I wrote a single process SSL client-server based upon the selfserv- tstclnt pair(but minus the threading..) Initially the entire thing was in C and worked properly; then I decided to make a C++ wrapper out of it to establish SSL connections... I used the same initialization configuration sequence as in selfserv and tstclnt but now several functions in both the applications are throwing up errors - all related to socket configuration. I've tried hard but cannot figure out what's wrong.. Could anybody kindly help me with a possible sequence of socket/addr c...

[Socket Programming]: Need info for Client / Server scenario
------_=_NextPart_001_01C446C4.9E9F1B0D Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi,=20 =20 I need some good links for understanding socket programming (Client / Server programming). I have written some scripts for multiple clients and a server (Forking Server).=20 But I am facing some problems - the server data has to be shared among all the child processes - does this happen when we fork - what should I do for this to happen. =20 Requirement is:=20 "Normal clients" keep polling the server for ...

IO::Socket::INET client hangs on no server on windoze
If there is no server or no connection this hangs for about 20 seconds and then crashes with the following error message. The Timeout seems to make no difference and the 'warn' does not occur. If works file with a good connection to a server. Using 5.8.8 active perl. Anyone got any suggestions for making it return undef in an orderly fashion? (I have tested it on Linux and it seems to work fine both ways) use strict; use warnings; use IO::Socket::INET; sub testSocket { my $sock; my $ok=0; unless( $sock=IO::Socket::INET->new(192.168.5.41, ...

Web resources about - Create a server socket from an existing client socket - embarcadero.delphi.win32

Pre-existing condition - Wikipedia, the free encyclopedia
J. James Rohack, president of the American Medical Association , has stated on a Fox News Sunday interview that exclusions, based upon these ...

How To Launch Existing Apps, Services From Facebook Developer SocialAppsHQ Under Your Brand
Facebook application developer SocialAppsHQ launched a white-label version of its platform, which allows agencies and other clients to create ...

A New Way To Re-Engage Your Existing Mobile App Users
Today we are introducing a new way to re-engage your mobile app users with Facebook ads. You can now advertise to people who have taken specific ...

Facebook expands IPO with additional 83.8M shares from existing stockholders
... according to an eighth amendment to its S-1 filing with the Securities and Exchange Commission. Most of these shares are being sold by existing ...

How do you grow your brand through existing clients?
Anna Farmery and I are doing a podcast this week on how to leverage happy clients to grow your brand. We&#39;d love to include your advice in ...

Anytune for Existing Anytune Pro Customers - Choose the Perfect Pitch. for iPhone, iPod touch, and iPad ...
Get Anytune for Existing Anytune Pro Customers - Choose the Perfect Pitch. on the App Store. See screenshots and ratings, and read customer reviews. ...

“The important thing is not to stop questioning. Curiosity has its own reason for existing.” Albert Einstein ...
Pretty dreary here today, but this stop sign caught my attention. Bright, vivid colors can draw attention and add "pop" to a photo. Make a photo ...

SIMple plan: More consumers taking existing mobile phones to new plans to 'enjoy freedom'
More Australians are holding on to their existing mobile phones when signing up to post-paid plans, saying they enjoy the &quot;freedom and flexibility&quot; ...

US existing home sales fall in August
... as investors retreated from real estate and first-time buyers remained scarce. The National Association of Realtors says sales of existing ...

Time to make existing fire-zone homes safer?
It's a timely question to pose.

Resources last updated: 12/31/2015 11:56:24 PM