|
You last visited: Today at 18:25
Advertisement
How To Receive Packets From Phconnector ?
Discussion on How To Receive Packets From Phconnector ? within the SRO Coding Corner forum part of the Silkroad Online category.
12/27/2013, 12:11
|
#1
|
elite*gold: 85
Join Date: Aug 2010
Posts: 1,278
Received Thanks: 524
|
How To Receive Packets From Phconnector ?
OKaii Guys i Done Work TO Connect TO Ph & Send Packts
its all Done Thanks For that informations
But what about Receive Packets Comming From Phconnector ?!
i tryed This
PHP Code:
Dim inStream(10024) As Byte
Dim DataLength As Integer = sroSocket.Receive(inStream)
sroSocket.Receive(inStream, 0, CInt(sroSocket.ReceiveBufferSize), SocketFlags.None)
Dim Packet As String = ""
For i As Integer = 0 To inStream.Length - 1
Packet += String.Format("{0:X2} ", inStream(i))
Next
Packet = Mid(Packet, 1, DataLength)
Msgbox(Packet)
But :-
1. Its Only Comings The Packets like 0104D02D000000
2. i think its too slow to get the packet or handle all packets
When i try For Ex To Get 1 Packet From Server and Send another like This
PHP Code:
If Packet.Contains("3080") Then
SendPacket("3080", "0100")
End If
its Didnt Do Any Thing Sure there is an Shit Error in The Previous Codes To get packets
- So ANy GooD way To Recive all packets ! ?
|
|
|
12/27/2013, 18:08
|
#2
|
elite*gold: 0
Join Date: Aug 2013
Posts: 10
Received Thanks: 2
|
i am not expert in this but i can tell if i could understand ur problem. pls make it clear for me may be i can help u
|
|
|
12/27/2013, 20:38
|
#3
|
elite*gold: 0
Join Date: Jan 2009
Posts: 314
Received Thanks: 686
|
First, stop handling packets like strings, that's outdated vb6.
I had this source laying around, it's kinda old tho but should work fine too.
Code:
Public Class ProxyConnection
Private Shared m_ProxySocket As Socket
Private Shared m_buffer As Byte()
Private Shared m_isClosing As Boolean
Public Shared Function Connect(ProxyPort As UShort) As Boolean
If m_ProxySocket Is Nothing Then
m_ProxySocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
End If
If m_ProxySocket.Connected Then
m_isClosing = True
m_ProxySocket.Shutdown(SocketShutdown.Both)
m_ProxySocket.Close()
m_ProxySocket = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
End If
If m_buffer Is Nothing Then
m_buffer = New Byte(8191) {}
End If
Try
m_isClosing = False
m_ProxySocket.Connect(IPAddress.Loopback, ProxyPort)
m_ProxySocket.BeginReceive(m_buffer, 0, 8192, SocketFlags.None, New AsyncCallback(AddressOf WaitForData), m_ProxySocket)
Return True
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
Return False
End Try
End Function
Private Shared Sub WaitForData(ar As IAsyncResult)
If m_ProxySocket IsNot Nothing Then
If m_isClosing = False Then
Try
Dim worker As Socket = DirectCast(ar.AsyncState, Socket)
If worker.EndReceive(ar) > 0 Then
'Create packet out of buffer
Dim packet = New phPacket(m_buffer)
'TODO : Send it to a packet handler
worker.BeginReceive(m_buffer, 0, 8192, SocketFlags.None, New AsyncCallback(AddressOf WaitForData), worker)
Else
'Connection Ended
m_isClosing = True
If m_ProxySocket.Connected Then
m_ProxySocket.Shutdown(SocketShutdown.Both)
m_ProxySocket.Close()
End If
m_ProxySocket = Nothing
End If
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End If
End If
End Sub
End Class
Code:
Public Class phPacket
Implements IDisposable
#Region "-----Field/Propertys-----"
''' <summary>
''' The Opcode as HexWord
''' </summary>
Public Property OpcodeHEX() As String
Get
Return m_Opcode.ToString("X2")
End Get
Set
m_Opcode = Convert.ToUInt16(value, 16)
End Set
End Property
''' <summary>
''' The Opcode as Ushort
''' </summary>
Public Property Opcode() As UShort
Get
Return m_Opcode
End Get
Set
m_Opcode = value
End Set
End Property
Private m_Opcode As UShort
Private m_SecurityCount As Byte
Public Property SecurityCount() As Byte
Get
Return m_SecurityCount
End Get
Set
m_SecurityCount = value
End Set
End Property
Private m_SecurityCrc As Byte
Public Property SecurityCrc() As Byte
Get
Return m_SecurityCrc
End Get
Set
m_SecurityCrc = value
End Set
End Property
''' <summary>
''' Current pointer position
''' </summary>
Public Property Pointer() As Integer
Get
Return m_Pointer
End Get
Set
m_Pointer = value
End Set
End Property
Private m_Pointer As Integer
''' <summary>
''' Packet Length
''' </summary>
Public Property Length() As Integer
Get
Return m_Length
End Get
Set
m_Length = value
End Set
End Property
Private m_Length As Integer
''' <summary>
''' BufferSize : Default 8192
''' </summary>
Public Property BufferSize() As Integer
Get
Return m_BufferSize
End Get
Set
m_BufferSize = value
Array.Resize(Of Byte)(m_Buffer, value)
End Set
End Property
Private m_BufferSize As Integer = 8192
'Silkroad Default: 8192
''' <summary>
''' Data Buffer
''' </summary>
Public Property Buffer() As Byte()
Get
Return m_Buffer
End Get
Set
m_Buffer = value
End Set
End Property
Private m_Buffer As Byte()
#End Region
#Region "-----Constructor-----"
''' <summary>
''' Creates an instance of cPacket using only the received bytes from client.
''' </summary>
''' <param name="buffer">The Bytearray received from client.</param>
Public Sub New(buffer As Byte())
m_Length = BitConverter.ToUInt16(buffer, 0)
m_Opcode = BitConverter.ToUInt16(buffer, 2)
m_SecurityCount = buffer(4)
m_SecurityCrc = buffer(5)
m_Buffer = New [Byte](m_BufferSize - 1) {}
If m_Length > 0 Then
Array.ConstrainedCopy(buffer, 6, m_Buffer, 0, m_Length)
End If
End Sub
''' <summary>
''' Creates an empty instance of cPacket using only the Opcode.
''' </summary>
''' <param name="Opcode">Opcode as ushort.</param>
Public Sub New(Opcode As UShort)
m_Opcode = Opcode
m_Buffer = New [Byte](m_BufferSize - 1) {}
End Sub
''' <summary>
''' Creates an empty instance of cPacket using only the Opcode.
''' </summary>
''' <param name="Opcode">Opcode as string.</param>
Public Sub New(Opcode As String)
m_Opcode = Convert.ToUInt16(Opcode, 16)
m_Buffer = New [Byte](m_BufferSize - 1) {}
End Sub
''' <summary>
''' Creates an intance of cPacket using the Opcode and Data(Buffer)
''' </summary>
''' <param name="Opcode">Opcode as ushort.</param>
''' <param name="Buffer">Data(Buffer) as Bytearray.</param>
Public Sub New(Opcode As UShort, Buffer As [Byte]())
m_Opcode = Opcode
m_Buffer = Buffer
End Sub
''' <summary>
''' Creates an intance of cPacket using the Opcode and Data(Buffer)
''' </summary>
''' <param name="Opcode">Opcode as ushort.</param>
''' <param name="Buffer">Data(Buffer) as HexString.</param>
Public Sub New(Opcode As UShort, Buffer As String)
m_Opcode = Opcode
m_Buffer = New [Byte](m_BufferSize - 1) {}
AddHex(Buffer)
End Sub
''' <summary>
''' Creates an intance of cPacket using the Opcode and Data(Buffer)
''' </summary>
''' <param name="Opcode">Opcode as string.</param>
''' <param name="Buffer">Data(Buffer) as Bytearray.</param>
Public Sub New(Opcode As String, Buffer As [Byte]())
m_Opcode = Convert.ToUInt16(Opcode, 16)
m_Buffer = Buffer
End Sub
''' <summary>
''' Creates an intance of cPacket using the Opcode and Data(Buffer)
''' </summary>
''' <param name="Opcode">Opcode as string.</param>
''' <param name="Buffer">Data(Buffer) as HexString.</param>
Public Sub New(Opcode As String, Buffer As String)
m_Opcode = Convert.ToUInt16(Opcode, 16)
m_Buffer = New [Byte](m_BufferSize - 1) {}
AddHex(Buffer)
End Sub
#End Region
#Region "-----Read-----"
''' <summary>
''' Reads a boolean value from buffer and increments the Pointer by 1.
''' </summary>
''' <returns>Returns the read byte as boolean.</returns>
Public Function ReadBool() As Boolean
'Increase Pointer
m_Pointer += 1
Return Convert.ToBoolean(m_Buffer(m_Pointer - 1))
End Function
''' <summary>
''' Reads a char value from buffer and increments the Pointer by 1.
''' </summary>
''' <returns>Returns the read byte as char.</returns>
Public Function ReadChar() As Char
'Increase Pointer
m_Pointer += 1
Return Convert.ToChar(m_Buffer(m_Pointer - 1))
End Function
''' <summary>
''' Reads a byte value from buffer and increments the Pointer by 1.
''' </summary>
''' <returns>the read byte.</returns>
Public Function ReadByte() As Byte
'Increase Pointer
m_Pointer += 1
Return m_Buffer(m_Pointer - 1)
End Function
''' <summary>
''' Reads a bytearray value from buffer and increments the Pointer by count.
''' </summary>
''' <param name="count">Number of bytes to read.</param>
''' <returns>the read bytearray.</returns>
Public Function ReadByte(count As Integer) As Byte()
'Increase Pointer
m_Pointer += count
'Copy to tempBuffer
Dim tempBuffer As Byte() = New Byte(count - 1) {}
Array.ConstrainedCopy(m_Buffer, m_Pointer - count, tempBuffer, 0, count)
Return tempBuffer
End Function
''' <summary>
''' Reads an ushort from buffer and increments the Pointer by 2.
''' </summary>
''' <returns>the read ushort.</returns>
Public Function ReadUShort() As UShort
'Increase Pointer
m_Pointer += 2
Return BitConverter.ToUInt16(m_Buffer, m_Pointer - 2)
End Function
''' <summary>
''' Reads a short from buffer and increments the Pointer by 2.
''' </summary>
''' <returns>the read short.</returns>
Public Function ReadShort() As Short
'Increase Pointer
m_Pointer += 2
Return BitConverter.ToInt16(m_Buffer, m_Pointer - 2)
End Function
''' <summary>
''' Reads an uinteger from buffer and increments the Pointer by 4.
''' </summary>
''' <returns>the read uinteger.</returns>
Public Function ReadUInteger() As UInteger
'Increase Pointer
m_Pointer += 4
Return BitConverter.ToUInt32(m_Buffer, m_Pointer - 4)
End Function
''' <summary>
''' Reads an integer from buffer and increments the Pointer by 4.
''' </summary>
''' <returns>the read integer.</returns>
Public Function ReadInteger() As Integer
'Increase Pointer
m_Pointer += 4
Return BitConverter.ToInt32(m_Buffer, m_Pointer - 4)
End Function
''' <summary>
''' Reads an ulong from buffer and increments the Pointer by 8.
''' </summary>
''' <returns>the read ulong.</returns>
Public Function ReadULong() As ULong
'Increase Pointer
m_Pointer += 8
Return BitConverter.ToUInt64(m_Buffer, m_Pointer - 8)
End Function
''' <summary>
''' Reads a long from buffer and increments the Pointer by 8.
''' </summary>
''' <returns>the read long.</returns>
Public Function ReadLong() As Long
'Increase Pointer
m_Pointer += 8
Return BitConverter.ToInt64(m_Buffer, m_Pointer - 8)
End Function
''' <summary>
''' Reads a float from buffer and increments the Pointer by 4.
''' </summary>
''' <returns>the read float.</returns>
Public Function ReadFloat() As Single
'Increase Pointer
m_Pointer += 4
Return BitConverter.ToSingle(m_Buffer, m_Pointer - 4)
End Function
''' <summary>
''' Reads the stringlength + ansi-string from buffer and increments the Pointer by 4 + stringlength.
''' </summary>
''' <returns>the read ANSI-String.</returns>
Public Function ReadString() As String
Dim length As Integer = ReadUShort()
'Increase Pointer
m_Pointer += length
Return Encoding.[Default].GetString(m_Buffer, m_Pointer - length, length)
End Function
''' <summary>
''' Reads an ansi-string from buffer using the given length and increments the Pointer by length.
''' </summary>
''' <returns>the read ANSI-String.</returns>
Public Function ReadString(length As Integer) As String
'Increase Pointer
m_Pointer += length
Return Encoding.[Default].GetString(m_Buffer, m_Pointer - length, length)
End Function
''' <summary>
''' Reads the stringlength + unicode string from buffer and increments the Pointer by 4 + stringlength.
''' </summary>
''' <returns>the read Unicode-String.</returns>
Public Function ReadUnicodeString() As String
Dim length As Integer = ReadUShort()
'Increase Pointer
m_Pointer += length
Return Encoding.Unicode.GetString(m_Buffer, m_Pointer - length, length)
End Function
''' <summary>
''' Reads an Unicode-string from buffer using the given length and increments the Pointer by length.
''' </summary>
''' <returns>the read Unicode-String.</returns>
Public Function ReadUnicodeString(length As Integer) As String
length *= 2
'Increase Pointer
m_Pointer += length
Return Encoding.Unicode.GetString(m_Buffer, m_Pointer - length, length)
End Function
#End Region
#Region "-----Add-----"
''' <summary>
''' Adds a boolean to the buffer and increments the length by 1.
''' </summary>
''' <param name="value">Boolean to add.</param>
Public Sub AddBool(value As Boolean)
m_Length += 1
m_Buffer(m_Length - 1) = Convert.ToByte(value)
End Sub
Public Sub AddBool(value As Object)
m_Length += 1
m_Buffer(m_Length - 1) = Convert.ToByte(value)
End Sub
''' <summary>
''' Adds a char to the buffer and increments the length by 1.
''' </summary>
''' <param name="value">Char to add.</param>
Public Sub AddChar(value As Char)
m_Buffer(m_Length) = Convert.ToByte(value)
m_Length += 1
End Sub
Public Sub AddChar(value As Object)
m_Buffer(m_Length) = Convert.ToByte(value)
m_Length += 1
End Sub
''' <summary>
''' Adds a byte to the buffer and increments the length by 1.
''' </summary>
''' <param name="value">Byte to add.</param>
Public Sub AddByte(value As Byte)
m_Buffer(m_Length) = value
m_Length += 1
End Sub
Public Sub AddByte(value As Object)
m_Buffer(m_Length) = Convert.ToByte(value)
m_Length += 1
End Sub
''' <summary>
''' Adds a Bytearray to the buffer and increments the length by Bytearray length.
''' </summary>
''' <param name="value">Bytearray to add.</param>
Public Sub AddByte(value As Byte())
'? What is faster CopyTo or ConstrainedCopy ?
'! Test done, result ConstrainedCopy
Array.ConstrainedCopy(value, 0, m_Buffer, m_Length, value.Length)
'value.CopyTo(pBuffer, pLength);
m_Length += value.Length
End Sub
''' <summary>
''' Adds an ushort to the buffer and increments the length by 2.
''' </summary>
''' <param name="value">Ushort to add.</param>
Public Sub AddUShort(value As UShort)
Array.ConstrainedCopy(BitConverter.GetBytes(value), 0, m_Buffer, m_Length, 2)
m_Length += 2
End Sub
Public Sub AddUShort(value As Object)
Array.ConstrainedCopy(BitConverter.GetBytes(Convert.ToUInt16(value)), 0, m_Buffer, m_Length, 2)
m_Length += 2
End Sub
''' <summary>
''' Adds a short to the buffer and increments the length by 2.
''' </summary>
''' <param name="value">Short to add.</param>
Public Sub AddShort(value As Short)
Array.ConstrainedCopy(BitConverter.GetBytes(value), 0, m_Buffer, m_Length, 2)
m_Length += 2
End Sub
Public Sub AddShort(value As Object)
Array.ConstrainedCopy(BitConverter.GetBytes(Convert.ToInt32(value)), 0, m_Buffer, m_Length, 2)
m_Length += 2
End Sub
''' <summary>
''' Adds an uinteger to the buffer and increments the length by 4.
''' </summary>
''' <param name="value">Uinteger to add.</param>
Public Sub AddUInteger(value As UInteger)
Array.ConstrainedCopy(BitConverter.GetBytes(value), 0, m_Buffer, m_Length, 4)
m_Length += 4
End Sub
Public Sub AddUInteger(value As Object)
Array.ConstrainedCopy(BitConverter.GetBytes(Convert.ToUInt32(value)), 0, m_Buffer, m_Length, 4)
m_Length += 4
End Sub
''' <summary>
''' Adds an integer to the buffer and increments the length by 4.
''' </summary>
''' <param name="value">Integer to add.</param>
Public Sub AddInteger(value As Integer)
Array.ConstrainedCopy(BitConverter.GetBytes(value), 0, m_Buffer, m_Length, 4)
m_Length += 4
End Sub
Public Sub AddInteger(value As Object)
Array.ConstrainedCopy(BitConverter.GetBytes(Convert.ToInt32(value)), 0, m_Buffer, m_Length, 4)
m_Length += 4
End Sub
''' <summary>
''' Adds an ulong to the buffer and increments the length by 8.
''' </summary>
''' <param name="value">Ulong to add.</param>
Public Sub AddULong(value As ULong)
Array.ConstrainedCopy(BitConverter.GetBytes(value), 0, m_Buffer, m_Length, 8)
m_Length += 8
End Sub
Public Sub AddULong(value As Object)
Array.ConstrainedCopy(BitConverter.GetBytes(Convert.ToUInt64(value)), 0, m_Buffer, m_Length, 8)
m_Length += 8
End Sub
''' <summary>
''' Adds an long to the buffer and increments the length by 8.
''' </summary>
''' <param name="value">Long to add.</param>
Public Sub AddLong(value As Long)
Array.ConstrainedCopy(BitConverter.GetBytes(value), 0, m_Buffer, m_Length, 8)
m_Length += 8
End Sub
Public Sub AddLong(value As Object)
Array.ConstrainedCopy(BitConverter.GetBytes(Convert.ToInt64(value)), 0, m_Buffer, m_Length, 8)
m_Length += 8
End Sub
''' <summary>
''' Adds a float to the buffer and increments the length by 4.
''' </summary>
''' <param name="value">Float to add.</param>
Public Sub AddFloat(value As Single)
Array.ConstrainedCopy(BitConverter.GetBytes(value), 0, m_Buffer, m_Length, 4)
m_Length += 4
End Sub
Public Sub AddFloat(value As Object)
Array.ConstrainedCopy(BitConverter.GetBytes(Convert.ToSingle(value)), 0, m_Buffer, m_Length, 4)
m_Length += 4
End Sub
''' <summary>
''' Adds an ANSI-String to the buffer and increments the length by stringlength.
''' </summary>
''' <param name="value">ANSI-String to add.</param>
Public Sub AddString(value As String)
Dim size As UShort = Convert.ToUInt16(value.Length)
'Add StringLength
AddUShort(size)
'Get Bytes & Copy to pBuffer
Dim tempBuffer As Byte() = Encoding.[Default].GetBytes(value)
Array.ConstrainedCopy(tempBuffer, 0, m_Buffer, m_Length, size)
'Incease Length
m_Length += size
End Sub
Public Sub AddString(value As Object)
Dim size As UShort = Convert.ToUInt16(DirectCast(value, String).Length)
'Add StringLength
AddUShort(size)
'Get Bytes & Copy to pBuffer
Dim tempBuffer As Byte() = Encoding.[Default].GetBytes(DirectCast(value, String))
Array.ConstrainedCopy(tempBuffer, 0, m_Buffer, m_Length, size)
'Incease Length
m_Length += size
End Sub
''' <summary>
''' Adds an Unicode-String to the buffer and increments the length by stringlength.
''' </summary>
''' <param name="value">Unicode-String to add.</param>
Public Sub AddUString(value As String)
Dim size As UShort = Convert.ToUInt16(value.Length)
'Add StringLength
AddUShort(size)
'Get Bytes & Copy to pBuffer
Dim tempBuffer As Byte() = Encoding.Unicode.GetBytes(value)
Array.ConstrainedCopy(tempBuffer, 0, m_Buffer, m_Length, size * 2)
'Incease Length
m_Length += (size * 2)
End Sub
Public Sub AddUString(value As Object)
Dim size As UShort = Convert.ToUInt16(DirectCast(value, String).Length)
'Add StringLength
AddUShort(size)
'Get Bytes & Copy to pBuffer
Dim tempBuffer As Byte() = Encoding.Unicode.GetBytes(DirectCast(value, String))
Array.ConstrainedCopy(tempBuffer, 0, m_Buffer, m_Length, size * 2)
'Incease Length
m_Length += (size * 2)
End Sub
Public Sub AddDate(value As DateTime)
AddUShort(value.Year)
AddUShort(value.Month)
AddUShort(value.Day)
AddUShort(value.Hour)
AddUShort(value.Minute)
AddUShort(value.Second)
AddUInteger(value.Millisecond)
End Sub
Public Sub AddDate(value As Object)
Dim [date] As DateTime = DirectCast(value, DateTime)
AddUShort([date].Year)
AddUShort([date].Month)
AddUShort([date].Day)
AddUShort([date].Hour)
AddUShort([date].Minute)
AddUShort([date].Second)
AddUInteger([date].Millisecond)
End Sub
''' <summary>
''' Adds a HexString to the buffer and increments the length by HexStringlength / 2.
''' </summary>
''' <param name="Hex">HexString to add.</param>
Public Sub AddHex(Hex As String)
Hex = Hex.Replace(" ", "")
Hex = Hex.Replace("-", "")
AddByte(ToByteArray(Hex))
End Sub
#End Region
''' <summary>
''' Resets the Pointer to 0.
''' </summary>
Public Sub ResetPointer()
m_Pointer = 0
End Sub
''' <summary>
''' Resets the Length to 0.
''' </summary>
Public Sub ResetLength()
m_Length = 0
End Sub
Private Sub ResetBuffer()
m_Buffer = New Byte(m_BufferSize - 1) {}
End Sub
''' <summary>
''' Clears the Buffer and resets the Pointer and Length.
''' </summary>
Public Sub Reset()
ResetBuffer()
ResetPointer()
ResetLength()
End Sub
''' <summary>
''' Converts the cPacket instance to Bytearray.
''' </summary>
''' <returns>the cPacket instance as Bytearray.</returns>
Public Function ToByteArray() As Byte()
Try
Dim packet As Byte() = New Byte(m_Length + 5) {}
BitConverter.GetBytes(m_Length).CopyTo(packet, 0)
BitConverter.GetBytes(m_Opcode).CopyTo(packet, 2)
Array.Resize(Of Byte)(m_Buffer, m_Length)
m_Buffer.CopyTo(packet, 6)
'pBuffer = new byte[pBufferSize];
Return packet
Catch ex As Exception
Throw ex
End Try
End Function
''' <summary>
''' Converts the Buffer to String.
''' </summary>
''' <returns>the buffer as String.</returns>
Public Overrides Function ToString() As String
If m_Length <> 0 Then
Dim sData As String = BitConverter.ToString(m_Buffer, 0, m_Length).Replace("-", "")
If m_Pointer > 0 Then
sData = sData.Insert(m_Pointer * 2, "|")
End If
Return sData
Else
Return "Empty"
End If
End Function
Public Sub Dispose()
Array.Clear(m_Buffer, 0, m_Buffer.Length)
m_Buffer = Nothing
End Sub
Private Function ToByteArray(HexString As String) As Byte()
Dim bytes As [Byte]() = New [Byte](HexString.Length \ 2 - 1) {}
For i As Integer = 0 To HexString.Length - 1 Step 2
bytes(i \ 2) = Convert.ToByte(HexString.Substring(i, 2), 16)
Next
Return bytes
End Function
End Class
|
|
|
12/28/2013, 06:24
|
#4
|
elite*gold: 85
Join Date: Aug 2010
Posts: 1,278
Received Thanks: 524
|
ThankS For ur Answer xD
Can you tell me how To Use This Moudels ? ! ?
|
|
|
12/29/2013, 13:45
|
#5
|
elite*gold: 0
Join Date: Aug 2013
Posts: 10
Received Thanks: 2
|
@its.soul
What is ur preferred coding language?
|
|
|
12/29/2013, 14:40
|
#6
|
elite*gold: 85
Join Date: Aug 2010
Posts: 1,278
Received Thanks: 524
|
Vb .net
@Tohoo my Problem is How Can i Receive Packets All packets .. nt packet by packet
i can upload my source if you wanna take a Look
|
|
|
12/29/2013, 15:30
|
#7
|
elite*gold: 0
Join Date: Aug 2013
Posts: 10
Received Thanks: 2
|
i sent u 3 mesage i hope it will help u .
|
|
|
02/19/2014, 18:30
|
#8
|
elite*gold: 0
Join Date: Apr 2008
Posts: 7
Received Thanks: 0
|
AutoIt script for geting all packets ...
Short AutoIt example for geting all packets... but thi is not going to decode packets...
Quote:
#include <GuiStatusBar.au3>
#include <GuiToolbar.au3>
#include <ToolbarConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <GuiEdit.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\Laptop\Desktop\Form1.kxf
$Form1 = GUICreate("", 641, 401, 254, 124)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1)
_GUICtrlStatusBar_SetSimple($StatusBar1)
_GUICtrlStatusBar_SetText($StatusBar1, "Status : ")
$Tab1 = GUICtrlCreateTab(8, 8, 372, 233)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUICtrlCreateTabItem("Primljeni")
$Edit1 = GUICtrlCreateEdit("", 16, 32, 320, 200, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETU RN,$WS_VSCROLL,$WS_HSCROLL), $WS_EX_STATICEDGE)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Spoji_nuConnector()
While 1
Primljeni_Paket()
Snimanje_Hoda()
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
Func Spoji_nuConnector()
_GUICtrlStatusBar_SetText($StatusBar1, "Status : Pokrenuto spajanje s nuConnectorom")
If ProcessExists("nuConnector.exe") Then
_GUICtrlStatusBar_SetText($StatusBar1, "Status : nuConnector već pokrenut")
ElseIf FileExists("nuConnector.exe") Then
Run("nuConnector.exe", "", @SW_HIDE)
_GUICtrlStatusBar_SetText($StatusBar1, "Status : nuConnector pokrenut")
EndIf
Sleep(1500)
TCPStartup()
$Soket = TCPConnect("127.0.0.1", 22580)
If $Soket = @error Then
_GUICtrlStatusBar_SetText($StatusBar1, "Status : Greška nemogu se spojiti s nuConnector.")
Else
_GUICtrlStatusBar_SetText($StatusBar1, "Status : nuConnector spojen")
EndIf
EndFunc
Func Primljeni_Paket()
$PrimljeniPaket = TCPRecv($Soket,4096,0)
Razvrstavanje_Paketa()
EndFunc
Func Razvrstavanje_Paketa()
$DjeloviPaketa[1]=StringMid($PrimljeniPaket,1,6)
$DjeloviPaketa[2]=StringMid($PrimljeniPaket,7,2)
$DjeloviPaketa[3]=StringMid($PrimljeniPaket,9,2)
$DjeloviPaketa[4]=StringMid($PrimljeniPaket,11,4)
$DjeloviPaketa[5]=StringMid($PrimljeniPaket,15)
$opKod = $DjeloviPaketa[3]&$DjeloviPaketa[2]
If $PrimljeniPaket <> "" Then
If $DjeloviPaketa[4] = "0000" Then
_GUICtrlEdit_AppendText($Edit1,"[S->C] [" & @HOUR &":"& @MIN &":"& @SEC &":"& @MSEC & "] " & @CRLF)
_GUICtrlEdit_AppendText($Edit1,"opKod : [" & $opKod & "]" & @CRLF)
_GUICtrlEdit_AppendText($Edit1,"Paket : [" &$DjeloviPaketa[5] & "]" & @CRLF & @CRLF)
ElseIf $DjeloviPaketa[4] ="0100" Then
_GUICtrlEdit_AppendText($Edit1,"[C->S] [" & @HOUR &":"& @MIN &":"& @SEC &":"& @MSEC & "] " & @CRLF)
_GUICtrlEdit_AppendText($Edit1,"opKod : [" & $opKod & "]" & @CRLF)
_GUICtrlEdit_AppendText($Edit1,"Paket : [" &$DjeloviPaketa[5] & "]" & @CRLF & @CRLF)
Else
_GUICtrlEdit_AppendText($Edit1,"[?->?]" & @CRLF)
_GUICtrlEdit_AppendText($Edit1,"Primljeni Paket : " & $PrimljeniPaket & @CRLF & @CRLF)
EndIf
EndIf
EndFunc
|
|
|
|
 |
Similar Threads
|
Working with sockets - Server & client [Send - Receive Packets]
11/12/2013 - CO2 Private Server - 9 Replies
Working with sockets - Server & client
Hello Epvps Members .. as title says ..
i am working on client and server deployment on C#
i used Conquer server socket " V 5518+ " and i created a client that connect to it .
i can send and receive bytes and convert it to message like here :
|
No receive packets
05/31/2013 - Mabinogi - 9 Replies
Alissa works for me but there are no receive packets displayed. Everything is send. Any idea what this means?
|
How?- receive packets -nuconnector&.Net
08/25/2011 - SRO Coding Corner - 3 Replies
what is the best way to receive data from nuconnector on .Net ??
byte , List<byte> ,List<ArraySegment<byte>>;
or what ??
and what is the format that Nuconnector us to send data to the bot !!!
?
|
WPE Doesn't receive any packets (reason: server or wud? @.@)
09/09/2010 - Ragnarok Online - 1 Replies
Ok. I am a newbie and am new to WPE. I searched, I read, I followed; still, i don't see any packets on my WPE. I already targeted my ro program, and started logging -> Packets : 0 >.<"" (i moved, dropped, picked things, ran around ig tho). The server i tried on was DreamerRo Nightmare Low rate (CS-Arena.com - professionelles Game-, Rootserver- & Housingbusiness). Sooo yea... I really appreciate every piece of advice from everyone. *-*
Thankss:confused:
|
edit/transfer/receive packets no detected from GG
03/16/2009 - Dekaron - 1 Replies
i want to know if someone can tell me the name(s) of a program to edit send and receive packets to use it in 2moons without getting caught by GG i tryed WPE but GG detects it as a troyan so pls someone help!!!
thnx
|
All times are GMT +1. The time now is 18:25.
|
|