Sending Hex to sockets?

This is a discussion on Sending Hex to sockets? within the Networking/Device Communication forums, part of the General Programming Boards category; Hi guys i'm writing a UDP client based on the example given in TCP/IP sockets in C book, but I ...

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    6

    Sending Hex to sockets?

    Hi guys i'm writing a UDP client based on the example given in TCP/IP sockets in C book, but I would like to know how to send a hex string to the socket.

    Currently when I write a hex string it is interpreted as ascii, but I would like it to be sent as it is written. Do I need to do ascii to hex conversion on the commandline argument or is it relating to the socket iteself.

    All help is greatly appreciated

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Considering that sending binary data across the network is subject to byte-order, isn't sending a hex-string actually a better choice anyways?

    Edit: Obviously at some point, the hex string will need to be translated to a binary value - but I would prefer to do that where it's being used, rather than the client side. It's obviously a subject that can only be determined on a personal preference basis.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sending structures through sockets
    By sunjayc99 in forum Networking/Device Communication
    Replies: 4
    Last Post: 07-01-2008, 08:43 PM
  2. Simple sockets - sending error
    By More_Coffee in forum Networking/Device Communication
    Replies: 4
    Last Post: 04-15-2007, 05:41 AM
  3. Sockets... Sending Binary Data. Please help
    By avalanche333 in forum C++ Programming
    Replies: 16
    Last Post: 03-31-2007, 01:56 PM
  4. Replies: 11
    Last Post: 03-24-2006, 11:26 AM
  5. Replies: 1
    Last Post: 08-01-2002, 09:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21