Jump to content
Sign in to follow this  
kudrow

Duplex TCP communication

Recommended Posts

kudrow

I have been playing with the TCP functions and I almost have all of it working the way I want. The listening server runs fine and accepts income connections and receives data but the reply from the server never makes it to the client. Just imagine an instant messenger type of application where data is transferred between 2 devices on the same (already created) connection. FireFox was nice enough to provide me with his new examples for the help file but they are not exactly what I am looking for.

So the basic idea is;

The script waits for a connection and data.

Once data is received the script sends the reply back to the orginating connection.

Never close the connection until a close command is initiated.

I hope I made this clear, if not let me know. Thanks!

Share this post


Link to post
Share on other sites
caleb41610

While 1
$recv = TCPRecv( $socket, 512 )
If $recv <> "" Then
; call a function
EndIf

$msg = GUIGetMsg( )
If $msg = $some_button Then
TCPSend( $socket, GUICtrlRead( $some_edit_control ) )
EndIf
WEnd

If you had a GUI on both sides with main loops similar to this, you could send/receive both ways

Edited by caleb41610

Share this post


Link to post
Share on other sites
bogQ

i made nice example not so long ago but you can search the formu for more examples.

if you have problems, post what you have (some small replicator) so that we can help you more

edit: guess i shud post that in example scripts and add to it some coment and explanation, cos i think wer getting more and more questions regarding communication betwean client and server.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
kudrow

i made nice example not so long ago but you can search the formu for more examples.

if you have problems, post what you have (some small replicator) so that we can help you more

edit: guess i shud post that in example scripts and add to it some coment and explanation, cos i think wer getting more and more questions regarding communication betwean client and server.

Your example above worked like a champ. Thank you very much. On to the next part of trying to figure out how to run a script that controls the windows gui without actually being logged in to the desktop. Thanks again everyone.

Share this post


Link to post
Share on other sites
caleb41610

Your example above worked like a champ. Thank you very much. On to the next part of trying to figure out how to run a script that controls the windows gui without actually being logged in to the desktop. Thanks again everyone.

I could be mistaken, but if a user is not logged in then there wouldn't be any program manager to interact with. Correct me if I am wrong though.

Share this post


Link to post
Share on other sites
kudrow

I could be mistaken, but if a user is not logged in then there wouldn't be any program manager to interact with. Correct me if I am wrong though.

You are correct, the only work around I have found is to use a virtual environment. They never lock or log out.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×