04-01-2013, 10:16 PM
|
#9
|
|
|
• الانـتـسـاب » Jul 2009
|
|
• رقـم العـضـويـة » 63352
|
|
• المشـــاركـات » 309
|
|
• الـدولـة » Home
|
|
• الـهـوايـة » Programming, imitating, media
|
|
• اسـم الـسـيـرفـر »
|
|
• الـجـنـس »
|
|
• نقـاط التقييم » 15
|
|
|
|
اولا: شكرا علي الموضوع بس برضو مش عارف اظبط packet 3013 ^^ اجيب كل حاجه اجي عند ال Items و اضيع 
ثانيا: بالنسبه للناس اللي عايزه ال code في VB.NET
كود:
Public Sub SendPacket(ByVal OpCode As String, ByVal sData As String, ByVal direction As Byte, ByVal Enc As Boolean)
Using buffer As New IO.MemoryStream
Using w As New IO.BinaryWriter(buffer)
w.Write(CUShort(0)) ' Size is 0 because it 'cannot' be known yet.
w.Write(CUShort("&H" + OpCode)) ' Converts the string Opcode to a UInt16, reading the Opcode as a hexadecimal representation
If Enc = True Then
If direction = 1 Then 'send to server
w.Write(CUShort(3)) ' Encryption flag phConnector
ElseIf direction = 2 Then 'send to client
w.Write(CUShort(4))
End If
Else
If direction = 1 Then 'send to server
w.Write(CUShort(1)) ' Encryption flag phConnector
ElseIf direction = 2 Then 'send to client
w.Write(CUShort(2))
End If
End If
For n As Integer = 0 To sData.Length / 2 - 1 ' Each byte is two characters and starting from 0 so decreasing by 1
w.Write(CByte("&H" & sData.Substring(n * 2, 2))) ' Writes every byte
Next
w.BaseStream.Position = 0 ' Resets the position to write the size
w.Write(CUShort(w.BaseStream.Length - 6)) ' Writes the size to the '0' placeholder
w.Flush() ' Makes sure the data is written to the buffer
Client.Send(buffer.ToArray) ' Sends the buffer to the Socket
End Using
End Using
End Sub
او ده
كود:
Public Sub SendPacket(ByVal OpCode As String, ByVal sData As String)
Using buffer As New IO.MemoryStream
Using w As New IO.BinaryWriter(buffer)
w.Write(CUShort(0))
w.Write(CUShort("&H" + OpCode))
w.Write(CUShort(1))
For n As Integer = 0 To sData.Length / 2 - 1
w.Write(CByte("&H" & sData.Substring(n * 2, 2)))
Next
w.BaseStream.Position = 0
w.Write(CUShort(w.BaseStream.Length - 6))
w.Flush()
Client.Send(buffer.ToArray)
End Using
End Using
End Sub
طبعاً لازم تعَرف ال Client الأول بعدها اعمل connect ل 127.0.0.1 وبال port بتاع phconnector
يا tarek لو مش عايز ال form تعلق اعمل thread جديده
كود:
Dim Recv As Thread = New Thread(AddressOf Receiving)
وبين
كود:
Private Sub Receiving()
End sub
اكتب ال code اللي مش عايزو يعلق فيه
شكرا مره ثانيه 
حولو انت ل #C بقي  y.png" border="0" alt="" title="Triggerhappy  y" class="inlineimg" />
|
|
|
التعديل الأخير تم بواسطة ahmdod2 ; 04-01-2013 الساعة 10:18 PM
|