Jump to content

Duplex TCP communication


kudrow
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

 
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...