Sign in to follow this  
Followers 0
NegativeNrG

Send Chat To server?

13 posts in this topic

hello, i was wondering if it was possible to send a text from a GUI to a game server(through TCP)

i know nothing about TCP so i was wondering if someone was able to start me up with a script?

Thanks.


[size=20]My File Upload[/size]Register at my site and upload.

Share this post


Link to post
Share on other sites



hello, i was wondering if it was possible to send a text from a GUI to a game server(through TCP)

i know nothing about TCP so i was wondering if someone was able to start me up with a script?

Thanks.

Depends on the game almost every game has a differend way to connect.

Lots of new games need cd keys to be able to logon also for security.

Share this post


Link to post
Share on other sites

It is more then possible. You just need too retreive the data from the GUI and send too the server. Have it store it. ETC. I already have a project dealing with this :P. Just read up the TCP Functionality and check my posts for examples...

AutoIt Smith

Share this post


Link to post
Share on other sites

It is more then possible. You just need too retreive the data from the GUI and send too the server. Have it store it. ETC. I already have a project dealing with this :P. Just read up the TCP Functionality and check my posts for examples...

AutoIt Smith

except for te post where you say you cannot send files over tcp functions over te internet.

donot read those all the scary capslock text in there.

For te record it is possible I made a script wich does work (unlike the really slow half working one posted there in the ideas section).

So you could also send binary data to chat (althougt chat almost always is text data)

Share this post


Link to post
Share on other sites

thanks for your reply, because i got a huge list of game servers ips/ports that

hopefully will connect, and ill look keep an eye on your post, and your programs.


[size=20]My File Upload[/size]Register at my site and upload.

Share this post


Link to post
Share on other sites

I have developed ITS Servers, internal server structures, admindb server, remote server, and a few other things. You should be able to extract ideas and examples from that.

Share this post


Link to post
Share on other sites

That is a bit flawed. Try this too build from:

Global Const $Port = 50911
Global $MaxConc = 100
Global $MainSocket = TCPStartServer($Port, $MaxConc)
If @error <> 0 Then Exit MsgBox(16, "Error", "Server unable to initialize.")
Global Const $MaxLength = 512
Global $ConnectedSocket[$MaxConc]
Global $CurrentSocket = 0
Local $Track = 0
Global Const $MaxConnection = ($MaxConc - 1)
For $Track = 0 To $MaxConnection Step 1
    $ConnectedSocket[$Track] = -1
Next
While 1
    $ConnectedSocket[$CurrentSocket] = TCPAccept($MainSocket)
    If $ConnectedSocket[$CurrentSocket] <> - 1 Then
        $CurrentSocket = SocketSearch()
    EndIf
    $Track = 0
    For $Track = 0 To $MaxConnection Step 1
        If $ConnectedSocket[$Track] <> - 1 Then
            $Data = TCPRecv($ConnectedSocket[$Track], $MaxLength)
            If $Data = "~bye" Then
                TCPCloseSocket($ConnectedSocket[$Track])
                $ConnectedSocket[$Track] = -1
                $CurrentSocket = SocketSearch()
            ElseIf $Data <> "" Then
                TCPSendMessageAll($MaxConnection, $Data)
            EndIf
        EndIf
    Next
WEnd
Func TCPSendMessageAll($ConnectionLimit, $Data)
    Local $Track = 0
    For $Track = 0 To $ConnectionLimit Step 1
        If $ConnectedSocket[$Track] <> - 1 Then TCPSend($ConnectedSocket[$Track], $Data)
    Next
EndFunc  ;==>TCPSendMessageAll
Func TCPStartServer($Port, $MaxConnect = 1)
    Local $Socket
    $Socket = TCPStartup()
    Select
        Case $Socket = 0
            SetError(@error)
            Return -1
    EndSelect
    $Socket = TCPListen(@IPAddress1, $Port, $MaxConnect)
    Select
        Case $Socket = -1
            SetError(@error)
            Return 0
    EndSelect
    SetError(0)
    Return $Socket
EndFunc  ;==>TCPStartServer
Func SocketSearch()
    Local $Track = 0
    For $Track = 0 To $MaxConnection Step 1
        If $ConnectedSocket[$Track] = -1 Then
            Return $Track
        Else
        ; Socket In Use
        EndIf
    Next
EndFunc  ;==>SocketSearch

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Servers are almost always remote.

For security you have to create more checking this aint save. Too much points where incorrect data can be received.

Edited by MrSpacely

Share this post


Link to post
Share on other sites

Thanks for your replys, But Smoke_N Figured it out!, Thanks :P.

Happy Holidays!


[size=20]My File Upload[/size]Register at my site and upload.

Share this post


Link to post
Share on other sites

Thanks for your replys, But Smoke_N Figured it out!, Thanks :P.

Happy Holidays!

Great but how could anyone help not even the name of the game was mentioned

Share this post


Link to post
Share on other sites

MySpacely, if you do not understand something, ask something about it. That server is an EXAMPLE structure which may need too be added to according too what people want. I gave him a base, which is what he needed. Also, you can always figure something out, without knowing the game. I don't know your real name, but I can tell you aren't very logical......

Share this post


Link to post
Share on other sites

That is a bit flawed. Try this too build from:

Global Const $Port = 50911
Global $MaxConc = 100
Global $MainSocket = TCPStartServer($Port, $MaxConc)
If @error <> 0 Then Exit MsgBox(16, "Error", "Server unable to initialize.")
Global Const $MaxLength = 512
Global $ConnectedSocket[$MaxConc]
Global $CurrentSocket = 0
Local $Track = 0
Global Const $MaxConnection = ($MaxConc - 1)
For $Track = 0 To $MaxConnection Step 1
    $ConnectedSocket[$Track] = -1
Next
While 1
    $ConnectedSocket[$CurrentSocket] = TCPAccept($MainSocket)
    If $ConnectedSocket[$CurrentSocket] <> - 1 Then
        $CurrentSocket = SocketSearch()
    EndIf
    $Track = 0
    For $Track = 0 To $MaxConnection Step 1
        If $ConnectedSocket[$Track] <> - 1 Then
            $Data = TCPRecv($ConnectedSocket[$Track], $MaxLength)
            If $Data = "~bye" Then
                TCPCloseSocket($ConnectedSocket[$Track])
                $ConnectedSocket[$Track] = -1
                $CurrentSocket = SocketSearch()
            ElseIf $Data <> "" Then
                TCPSendMessageAll($MaxConnection, $Data)
            EndIf
        EndIf
    Next
WEnd
Func TCPSendMessageAll($ConnectionLimit, $Data)
    Local $Track = 0
    For $Track = 0 To $ConnectionLimit Step 1
        If $ConnectedSocket[$Track] <> - 1 Then TCPSend($ConnectedSocket[$Track], $Data)
    Next
EndFunc ;==>TCPSendMessageAll
Func TCPStartServer($Port, $MaxConnect = 1)
    Local $Socket
    $Socket = TCPStartup()
    Select
        Case $Socket = 0
            SetError(@error)
            Return -1
    EndSelect
    $Socket = TCPListen(@IPAddress1, $Port, $MaxConnect)
    Select
        Case $Socket = -1
            SetError(@error)
            Return 0
    EndSelect
    SetError(0)
    Return $Socket
EndFunc ;==>TCPStartServer
Func SocketSearch()
    Local $Track = 0
    For $Track = 0 To $MaxConnection Step 1
        If $ConnectedSocket[$Track] = -1 Then
            Return $Track
        Else
    ; Socket In Use
        EndIf
    Next
EndFunc ;==>SocketSearch
Pardon my noobishness, but where did you find the documentation for these functions (like, TCPStartServer and all). I'm trying to create my own chat, but I would like to read the documentation first.

Please point me in the right direction thanks.


---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

he just made his own UDF just i duno why..

look at the BETA help file to see the TCP/UDP Funcs.


[size=20]My File Upload[/size]Register at my site and upload.

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  
Followers 0