473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

hex sending

s.send("abc") # send test string

I need to send hex:"10 06 00 0f 02 bc d1" instead of "abc"

hoW?

Oct 4 '06 #1
5 10477
"hiroc" wrote:
s.send("abc") # send test string

I need to send hex:"10 06 00 0f 02 bc d1" instead of "abc"
do you want to send seven binary bytes, or pairs of hexadecimal characters
separated by whitespace ?

how do you map from "abc" to "10 06 00 0f 02 bc d1", by the way? what
encoding is that?

</F>

Oct 4 '06 #2
I want send pairs of hexadecimal characters, abc is only my test hex
char is real

Fredrik Lundh wrote:
"hiroc" wrote:
s.send("abc") # send test string

I need to send hex:"10 06 00 0f 02 bc d1" instead of "abc"

do you want to send seven binary bytes, or pairs of hexadecimal characters
separated by whitespace ?

how do you map from "abc" to "10 06 00 0f 02 bc d1", by the way? what
encoding is that?

</F>
Oct 4 '06 #3

hiroc wrote:
I want send pairs of hexadecimal characters, abc is only my test hex
char is real
Possibly this code helps to you:

import binascii

binascii.hexlify('hello worlds')

Output: '68656c6c6f20776f726c6473'

Oct 4 '06 #4
"hiroc" <hi*****@hotmail.comwrote:
>s.send("abc") # send test string

I need to send hex:"10 06 00 0f 02 bc d1" instead of "abc"

hoW?
One ugly way is
s.send( "\x10\x06\x00\x0f\x02\xbc\xd1" )
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Oct 5 '06 #5
"hiroc" <hi*****@hotmail.comwrites:
s.send("abc") # send test string
I need to send hex:"10 06 00 0f 02 bc d1" instead of "abc"
See the binascii module:

import binascii

# a2b_hex stands for "ascii to binary conversion, hex format"
# you must remove the spaces
binary = binascii.a2b_hex ("1006000f02bcd1")

s.send (binary)
Oct 5 '06 #6

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

Similar topics

1
by: coder_1024 | last post by:
I'm trying to send a packet of binary data to a UDP server. If I send a text string, it works fine. If I attempt to send binary data, it sends a UDP packet with 0 bytes of data (just the...
0
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
3
by: Robert A. van Ginkel | last post by:
Hello Fellow Developer, I use the System.Net.Sockets to send/receive data (no tcpclient/tcplistener), I made a receivethread in my wrapper, the receivethread loops/sleeps while waiting for data...
4
by: yaron | last post by:
Hi, I have a problem when sending data over TCP socket from c# client to java server. the connection established ok, but i can't send data from c# client to java server. it's work ok with...
7
by: Lau | last post by:
I need to send 1000 emails from an asp.net website. Normally I would use System.Web.Mail.MailMessage() to send thru an SMTP server. But the large amount of emails results in a timeout. My server...
3
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is...
0
by: remya1000 | last post by:
by using FTP i can send files to server using vb.net. if the file is big, then it will take some time to complete the sending process to server.or if we were sending 3-4 files to the server one by...
9
by: JoeP | last post by:
Hi All, How can I find the reason for such an error: Failure sending mail. Some Code... oMailMessage.IsBodyHtml = False oMailMessage.Body = cEmailBody Dim oSMTP As New SmtpClient...
4
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.