473,732 Members | 2,043 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I send HEX numbers across TCP?

I am tring to send out of a TCP port, the hext digits:

FF010040000042

I can't quite get the syntax in my head:

Command="FFH010 040000042"
Dim sendBytes As [Byte]() = System.Text.Enc oding.ASCII.Get Bytes(Command)
networkStream.W rite(sendBytes, 0, sendBytes.Lengt h)

This isn't going to work as it will send the ascii characters instead of
the hex values.

Can anyone help please?

-Jerry
Jul 4 '07 #1
6 6381
Hello,

"jim" <ji*@yourpc.edu schreef in bericht
news:vP******** *********@bigne ws3.bellsouth.n et...
nevermind.....I got it.

"jim" <ji*@yourpc.edu wrote in message
news:id******** **********@bign ews3.bellsouth. net...
>>I need to know if a laptop is connected to the Bellsouth network or the
Sprint wireless network. How can this be done with VB.Net 2005?
Can you please post how you are doing this? I am trying to determine if a PC
is connected to a certain netwoek.

Thanks,

Michel

Jul 4 '07 #2
How about

byte[] bytes = new byte[] {0xff, ... } - this is C# syntax

and writing them to the stream?

But I am not sure what if H0 after FF - probably typo?
"Jerry Spence1" <je**********@s omewhere.co.ukw rote in message
news:46******** **************@ ptn-nntp-reader02.plus.n et...
>I am tring to send out of a TCP port, the hext digits:

FF010040000042

I can't quite get the syntax in my head:

Command="FFH010 040000042"
Dim sendBytes As [Byte]() = System.Text.Enc oding.ASCII.Get Bytes(Command)
networkStream.W rite(sendBytes, 0, sendBytes.Lengt h)

This isn't going to work as it will send the ascii characters instead of
the hex values.

Can anyone help please?

-Jerry


Jul 4 '07 #3
Sorry - the H0 was a typo. I was originally thinking of sending FFh as a
single byte and I forgot to remove it when I sent the post.

Sorry I don't understand C#

It's hard to explain what I mean, but I am trying to send out the actual Hex
values, rather than the string itself. It's the difference between sending
FFh (ie 11111111) and "FF" (which will send the ascii values for FF).

-I hope that helps

Thanks so far!

-Jerry

"AlexS" <sa***********@ SPAMrogers.comP LEASEwrote in message
news:eM******** ******@TK2MSFTN GP06.phx.gbl...
How about

byte[] bytes = new byte[] {0xff, ... } - this is C# syntax

and writing them to the stream?

But I am not sure what if H0 after FF - probably typo?
"Jerry Spence1" <je**********@s omewhere.co.ukw rote in message
news:46******** **************@ ptn-nntp-reader02.plus.n et...
>>I am tring to send out of a TCP port, the hext digits:

FF0100400000 42

I can't quite get the syntax in my head:

Command="FFH01 0040000042"
Dim sendBytes As [Byte]() = System.Text.Enc oding.ASCII.Get Bytes(Command)
networkStream. Write(sendBytes , 0, sendBytes.Lengt h)

This isn't going to work as it will send the ascii characters instead of
the hex values.

Can anyone help please?

-Jerry



Jul 4 '07 #4
This should work:

dim sendBytes() as Byte = { &Hff, &H01, &H00, &H40, ... }

networkStream.W rite(sendBytes, 0, sendBytes.Lengt h)
"Jerry Spence1" <je**********@s omewhere.co.ukw rote in message
news:46******** **************@ ptn-nntp-reader02.plus.n et...
Sorry - the H0 was a typo. I was originally thinking of sending FFh as a
single byte and I forgot to remove it when I sent the post.

Sorry I don't understand C#

It's hard to explain what I mean, but I am trying to send out the actual
Hex values, rather than the string itself. It's the difference between
sending FFh (ie 11111111) and "FF" (which will send the ascii values for
FF).

-I hope that helps

Thanks so far!

-Jerry

"AlexS" <sa***********@ SPAMrogers.comP LEASEwrote in message
news:eM******** ******@TK2MSFTN GP06.phx.gbl...
>How about

byte[] bytes = new byte[] {0xff, ... } - this is C# syntax

and writing them to the stream?

But I am not sure what if H0 after FF - probably typo?
"Jerry Spence1" <je**********@s omewhere.co.ukw rote in message
news:46******* *************** @ptn-nntp-reader02.plus.n et...
>>>I am tring to send out of a TCP port, the hext digits:

FF01004000004 2

I can't quite get the syntax in my head:

Command="FFH0 10040000042"
Dim sendBytes As [Byte]() = System.Text.Enc oding.ASCII.Get Bytes(Command)
networkStream .Write(sendByte s, 0, sendBytes.Lengt h)

This isn't going to work as it will send the ascii characters instead
of the hex values.

Can anyone help please?

-Jerry




Jul 4 '07 #5

"Jerry Spence1" <je**********@s omewhere.co.ukw rote in message
news:46******** **************@ ptn-nntp-reader02.plus.n et...
Sorry - the H0 was a typo. I was originally thinking of sending FFh as a
single byte and I forgot to remove it when I sent the post.

Sorry I don't understand C#

It's hard to explain what I mean, but I am trying to send out the actual
Hex values, rather than the string itself. It's the difference between
sending FFh (ie 11111111) and "FF" (which will send the ascii values for
FF).

-I hope that helps

Thanks so far!

-Jerry

"AlexS" <sa***********@ SPAMrogers.comP LEASEwrote in message
news:eM******** ******@TK2MSFTN GP06.phx.gbl...
>How about

byte[] bytes = new byte[] {0xff, ... } - this is C# syntax

and writing them to the stream?

But I am not sure what if H0 after FF - probably typo?
"Jerry Spence1" <je**********@s omewhere.co.ukw rote in message
news:46******* *************** @ptn-nntp-reader02.plus.n et...
>>>I am tring to send out of a TCP port, the hext digits:

FF01004000004 2

I can't quite get the syntax in my head:

Command="FFH0 10040000042"
Dim sendBytes As [Byte]() = System.Text.Enc oding.ASCII.Get Bytes(Command)
networkStream .Write(sendByte s, 0, sendBytes.Lengt h)

This isn't going to work as it will send the ascii characters instead
of the hex values.

Can anyone help please?

-Jerry



something like this?...

Dim mydata() As Byte = New Byte(0 To 7) { _
&H1, &HFF, &HF1, &H55, &H1, &HFF, &HFF, &H0}

Send(mydata)


-Blake

Jul 4 '07 #6

"Blake" <no@emailwrot e in message
news:OE******** ******@TK2MSFTN GP05.phx.gbl...
>
"Jerry Spence1" <je**********@s omewhere.co.ukw rote in message
news:46******** **************@ ptn-nntp-reader02.plus.n et...
>Sorry - the H0 was a typo. I was originally thinking of sending FFh as a
single byte and I forgot to remove it when I sent the post.

Sorry I don't understand C#

It's hard to explain what I mean, but I am trying to send out the actual
Hex values, rather than the string itself. It's the difference between
sending FFh (ie 11111111) and "FF" (which will send the ascii values for
FF).

-I hope that helps

Thanks so far!

-Jerry

"AlexS" <sa***********@ SPAMrogers.comP LEASEwrote in message
news:eM******* *******@TK2MSFT NGP06.phx.gbl.. .
>>How about

byte[] bytes = new byte[] {0xff, ... } - this is C# syntax

and writing them to the stream?

But I am not sure what if H0 after FF - probably typo?
"Jerry Spence1" <je**********@s omewhere.co.ukw rote in message
news:46****** *************** *@ptn-nntp-reader02.plus.n et...
I am tring to send out of a TCP port, the hext digits:

FF0100400000 42

I can't quite get the syntax in my head:

Command="FFH 010040000042"
Dim sendBytes As [Byte]() =
System.Text. Encoding.ASCII. GetBytes(Comman d)
networkStrea m.Write(sendByt es, 0, sendBytes.Lengt h)

This isn't going to work as it will send the ascii characters instead
of the hex values.

Can anyone help please?

-Jerry



something like this?...

Dim mydata() As Byte = New Byte(0 To 7) { _
&H1, &HFF, &HF1, &H55, &H1, &HFF, &HFF, &H0}

Send(mydata)


-Blake
Thank you Blake and Alex. That was it. Very grateful

-Jerry
Jul 5 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
1945
by: Leon | last post by:
I have six textbox controls on my webform that allows the user to enter any numbers from 1 to 25 in any order. However, I would like to sort those numbers from least to greatest before sending them to the database. How can accomplish this task? Thanks!
1
3863
by: Thane Walkup | last post by:
Greetings, I'm trying to write an app that will reply automatically to a message received in Outlook 2002 as part of a Rules Wizard scripting call. I originally tried VBA, but discovered quite rapidly that Microsoft's attempts to secure Outlook against script execution has made this impossible to do from VBA. I've attempted to move this into a VB.NET application, and I'm experiencing some problems with the code. I will admit up front...
3
2348
by: Jon | last post by:
Hi, in my program, i want to send a signal to other computer on the network (LAN). so that when other recieves this signal, it will do something... What Class should I use for sending the signal? Is there any example code i can find? thankyou very much in advance!
5
4076
by: soeren | last post by:
Hello, two days ago I stumbled across a very strange problem that came up when we were printing tiny double numbers as strings and trying to read them on another place. This is part of an object serialisation framework that cannot be done in binary format currently, so please no comments about this ,-)) It took quite some time to shrink down the problem but it looks like that C++ does not behave well in regards to very tiny numbers.
8
25472
by: kiranchahar | last post by:
Hey all, How do I generate random numbers with Uniform distribution Uniform(a,b) using C-programming? I want to generate uniform random numbers which have mean following Uniform(p,q) and also variance as Uniform(s,t)? any suggestion would be really appreciated. Thanks, Kay
1
2130
by: sconnors | last post by:
I am currently working on an application that runs on Windows XP SP2 with .NET 2.0, Linux 2.4.19-16mdkenterprise and Solaris 5.9. The language is C++. When I compare the output numbers, Windows rounds the numbers up (for example: 13030.65 becomes 13030.7 - precision is 6) and in Linux/Solaris the number is rounded down or more likely truncated (for example: 13030.65 becomes 13030.6). I can set the precision on the ostream or output file...
1
2889
by: mcneilkm | last post by:
Hi all, I am a newby to this forum. I am making modifications to an existing database. The structure is basicall one primary record in a main table with many associated records in a second table. The associated records has a field in it called hours and is formated as a number. I need to update this field based on criteria in a text box which is also a number. In all the the idea is to take the text box number which represent cuts to the...
1
4396
by: Daniel | last post by:
Hello, I've been building a system that has need to send object data across the network. The approach I've taken has been to build Data Transfer Objects, which just contain the attributes of the objects, and to pickle them and send them over a socket connection. As I get deeper this is a bit problematic, and so I was wondering if there is a package or framework that is already designed to do this?
0
8944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8773
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9234
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9180
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6733
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2177
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.