sending packet to server
sending packet to server
sending packet to server
sending packet to server
sending packet to server
sending packet to server sending packet to server sending packet to server sending packet to server sending packet to server sending packet to server sending packet to server sending packet to server
sending packet to server sending packet to server
sending packet to server
Go Back  Xtreme Visual Basic Talk > > > sending packet to server


Reply
 
Thread Tools Display Modes
  #1  
Old 04-12-2012, 12:07 AM
Binarybot Binarybot is offline
Newcomer
 
Join Date: Mar 2012
Posts: 3
Unhappy sending packet to server


hello all

i want ask how i can send hex packet to server

i am able to connect IP and port

in packet the data i send is .3......•....
the hex code of data is 00 33 00 07 00 00 04 0F 95 13 00 00 00
here we can see that
for 3 hex 33 is used and for char "." 00 07 13 and many others are used
and for • its 0F used

now if i use code like this

Code:
 tcpClient.Connect("64.145.67.45", 8080) 'connecting the client the server
        'port is same as in the server
        
        Dim strMessage As String = ".3......•...."

        Dim stm As NetworkStream = tcpClient.GetStream() 'getting the stream of the client'
         ' Dim streamwriter As New StreamWriter(stm)'
        'streamwriter.WriteLine(strMessage)'

        Dim ascenc As ASCIIEncoding
        Dim byteData() As Byte = ascenc.GetBytes(strMessage) 'converting the data into bytes'
        stm.Write(byteData, 0, byteData.Length()) 'writing/transmitting the message
it sends same Hex for each "." in packet
but i want to send other values as there in original
so i want to create a byte to send from hex code
how can i send that ??

plzz help me to send Hex values in packet

thanks in advance

-Binarybot
Reply With Quote
  #2  
Old 04-12-2012, 03:48 AM
PlausiblyDamp's Avatar
PlausiblyDampsending packet to server PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

The StreamWriter class is used for sending character based data to a stream, not raw bytes. If you are just wanting to send an ascii version of a string then one of the overloads such as http://msdn.microsoft.com/en-us/library/3aadshsx.aspx might be more useful.

If you are really wanting to send arbitrary bytes to a stream then you are probably better of using a BinaryWriter to do the job.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #3  
Old 04-13-2012, 12:40 AM
Binarybot Binarybot is offline
Newcomer
 
Join Date: Mar 2012
Posts: 3
Default

thanks
i cannot use streamwriter becoz it changes the raw Hex data
i will try binarywriter
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
sending packet to server
sending packet to server
sending packet to server sending packet to server
sending packet to server
sending packet to server
sending packet to server sending packet to server sending packet to server sending packet to server sending packet to server sending packet to server sending packet to server
sending packet to server
sending packet to server
 
sending packet to server
sending packet to server
 
-->