[HELP!!] game socket_connession with VisualBasic.NET!!!!

02/17/2012 17:37 -Legor-#1
Hello, i'm trying to connect my software at metin2's server, with socket connection.
But I do not know when i err..
This is the code:
Code:
        Dim query As String = "@SHOWMETHEMONEY.@BLOCK username 10."
        Dim host As IPAddress = Nothing
        Dim mySock As Socket = Nothing

        Try
            If Not IPAddress.TryParse("5.100.136.100", host) Then
                MessageBox.Show("This IP is not valid")
                Exit Sub
            End If

            Dim ep As IPEndPoint = New IPEndPoint(host, Integer.Parse(30000))
            mySock = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

            mySock.Connect(ep)

            If mySock.Connected Then

                mySock.Send(Encoding.ASCII.GetBytes(query))

                MsgBox("Sended!")
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
Everything works perfectly, the connection is made, I receive the message "sended", but i have not consequences ingame.

Can you help me?:handsdown:
02/17/2012 17:51 Mashkin#2
Quote:
Originally Posted by -Legor- View Post
Hello, i'm trying to connect my software at metin2's server, with socket connection.
But I do not know when i err..
This is the code:
Code:
        Dim query As String = "@SHOWMETHEMONEY.@BLOCK username 10."
        Dim host As IPAddress = Nothing
        Dim mySock As Socket = Nothing

        Try
            If Not IPAddress.TryParse("5.100.136.100", host) Then
                MessageBox.Show("This IP is not valid")
                Exit Sub
            End If

            Dim ep As IPEndPoint = New IPEndPoint(host, Integer.Parse(30000))
            mySock = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)

            mySock.Connect(ep)

            If mySock.Connected Then

                mySock.Send(Encoding.ASCII.GetBytes(query))

                MsgBox("Sended!")
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
Everything works perfectly, the connection is made, I receive the message "sended", but i have not consequences ingame.

Can you help me?:handsdown:
Have you checked your query?
I guess there has to be an "newline" character after the two parts of the query.
Also, the command should be "BLOCK_CHAT" rather than "BLOCK".
Code:
@SHOWMETHEMONEY\n@BLOCK_CHAT charname 10\n
--or--
\0x40SOWMETHEMONEY\0x0A\0x40BLOCK_CHAT charname 10\0x0A
I don't know the correct syntax for VB strings and character escaping but that should be right.
02/17/2012 18:43 -Legor-#3
Quote:
Originally Posted by M@shkin View Post
Have you checked your query?
I guess there has to be an "newline" character after the two parts of the query.
Also, the command should be "BLOCK_CHAT" rather than "BLOCK".
Code:
@SHOWMETHEMONEY\n@BLOCK_CHAT charname 10\n
--or--
\0x40SOWMETHEMONEY\0x0A\0x40BLOCK_CHAT charname 10\0x0A
I don't know the correct syntax for VB strings and character escaping but that should be right.
I'm trying. :)

not seem to work .. But I think the problem is caused by "/ x00" etc.