TCPSend or TCPrecv problem

Recommended Posts

I want to make a remote control for my desktop computer. A client GUI on my laptop should control a server on my desktop.

Now I found a nice script online and spent a whole day trying to make it work, but I'm stuck at a certain point. The connection is being established fine, just the TCPSend command in the client or the TCPRecv command on the server does not work.

Would be great, if someone could look at the code and find the bug, that is causing the malfunctioning.

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.

The thing about the error loop, I did not really understand. I thought the $err loop already exits on the very end. Can you explain please?

Look @ my signature if you wanna read some more about tcp

I already found that one and read it. That's some grerat info.

The problem with my code doesn't seem to be the "Until $ConnectedSocket > 0", as the connection is being properly established. This is, what the "BEEP" proofs to me. Also the error thing, as there appears no error message. Must be something different. Can you check?

Share this post

Link to post

Share on other sites

remove your While 1 loop on server and you will see that your script is exiting "do untill" loop to early

you can try to do this to recive one (probably onlu one) msg (coz of badly formated server loop dont think you can recive on server more than one msg correclty in this testing situation)

so instead

Until$err;We basically keep on "receiving" information until TCPShutdown is called, which only happens if

Try to change to

Until$err > 0;We basically keep on "receiving" information until TCPShutdown is called, which only happens if

Explanation for your loop and whats wrong with it,

TCPRecv will geave out error if it cant pull anyting, so your $err is under @error from the start on first loop right after client is connected (coz you still did not send msg from clinet and your server first loop for trying to recive msg started), so after first loop script will get out from reciving "do untill" loop automaticly and itl go back to your "TCPAccept do untill" loop cos of influance of yout "While 1" main loop.

So tellme do you understand now about what im telling you is wrong in that loop?

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

remove your While 1 loop on server and you will see that your script is exiting "do untill" loop to early

you can try to do this to recive one (probably onlu one) msg (coz of badly formated server loop dont think you can recive on server more than one msg correclty in this testing situation)

so instead

Until$err;We basically keep on "receiving" information until TCPShutdown is called, which only happens if

Try to change to

Until$err > 0;We basically keep on "receiving" information until TCPShutdown is called, which only happens if

Explanation for your loop and whats wrong with it,

TCPRecv will geave out error if it cant pull anyting, so your $err is under @error from the start on first loop right after client is connected (coz you still did not send msg from clinet and your server first loop for trying to recive msg started), so after first loop script will get out from reciving "do untill" loop automaticly and itl go back to your "TCPAccept do untill" loop cos of influance of yout "While 1" main loop.

So tellme do you understand now about what im telling you is wrong in that loop?

Great! Thanks a lot, now I understand, what you meant! :-)

Meanwhile I've tried to change the loop to "until 1 = 2" instead of "until $err = 0" and this also worked, but of course the loop did not make much sence. But now the solution is perfect. So thanks again! :-)