Click here to Skip to main content
15,905,148 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i trying to make a Packet Header for my TCP Packets so i can simple on the server application know what the packet are for and where it should go,i have search on google and found one link that looks out what i where looking for but i can't get it to work here is the link
i hope someone can help me to get it to work.

If not do someone know another way to do it? or how to fix this code and think about add 10 bytes to the buffer i sending but i really want someone like this do someone know how to do this?
Updated 5-Mar-14 6:10am
CPallini 5-Mar-14 8:22am    
Why don't you get it work?
ZurdoDev 5-Mar-14 10:15am    
Where are you stuck?
wawada 5-Mar-14 11:56am    
at this line of code
Public Sub New(ByVal header As packetHeader, ByVal data As Object)
_header = header
_data = data ' Says that it cannot convert to Byte
End Sub
Public Shared Function Serialize(myPacket As Packet) As Byte()
Dim fs As New MemoryStream
Dim formatter As New BinaryFormatter
formatter.Serialize(fs, myPacket) ' here is fails because it cannot Serialize for something is not specify but i can find out why ;;/
Return fs.ToArray
End Function
Sergey Alexandrovich Kryukov 5-Mar-14 12:19pm    
Why? Are you creating TCP implementation or something?
wawada 5-Mar-14 12:41pm    
i trying to make so i can read my packets between my server and client easier using (TCP) connections but i can get it to work and i have try to send first 1 string like this "Header:Image" and then the data but when it try to send 2 things at the same time it getting stuck and it disconnects i hope someone understand what i writing

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900