Jump to content

Recommended Posts

Posted

Hey guys, I am working on something to help me better understand how TCP works. I am having a lot of trouble. I have looked at many examples and thought I figured it out and still nothing.

I was wondering if someone can send me an example that would use all the TCP functions. Make it super simple please. I have looked at that chat server/client and it is just so confusing.

I have made a server/client chatting thing but the client can not reconnect when it is restarted???

Thank you guys so much, I just want to figure this out once and for all.

Check out ConsultingJoe.com
Posted

Check my posts. TCP Made easy is very simple. I also made a SIMPLE example... Pretty much as simple as it gets in my topic in my signature.

TCP Server Example and TCP Client Example at the bottom of the first post.

Servers:

TCPStartUp

TCPListen

TCPAccept

TCPRecv

TCPSend

TCPCloseSocket

TCPShutdown

Clients:

TCPStartup

TCPConnect

TCPRecv

TCPSend

TCPCloseSocket

TCPShutdown

I hope you can figure it out, for more indepth help, message me.

Posted (edited)

TCP Server:

Always run servers first.

You might want to use and edit this function to check on currently connected client. Add this to the server and edit it according to your variables.

AdlibEnable("UpdateSocket", 2000)
;....At Bottom
Func UpdateSocket()
If TCPSend($ConnectedSocket, "~test") = 0 Then $ConnectedSocket = TCPCloseSocket($ConnectedSocket)
EndFunc

Also make $ConnectedSocket a GLOBAL variable and set it on the return of TCPCloseSocket.

For the client add something like:

If $Data <> "" and  $Data <> "~test"
;Continue.....
EndIf

That may help.

Edited by AutoIt Smith

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
×
×
  • Create New...