TCP Sending Unsigned Char...
Posted on
16th Feb 2014 07:03 pm by
admin
Hi...
I want to send over tcp/ip some data, i have the data in hexadecimal, and when i try to send it, i have a few problems.
I give the data as a parameter to the program... argv[1]
Example of argv[1] = "0518EF5600AD"
This is hexadecimal data (05 18 EF 56 00 AD)
The main problem for me is the Send function...
Code:
int send(
__in SOCKET s,
__in const char* buf,
__in int len,
__in int flags
);
How can i send this data if the 2 parameter in the send funcion is a CHAR... and i need to send some null strings like Hex(00)...
I would like to send this:
Code:
unsigned char info[] =
{
0x84, 0xFA, 0xEF, 0x00,
0x01, 0xEF, 0x05, 0x31,
0x01, 0x01, 0x01, 0x20,
0xF9, 0xC7, 0xDC, 0x79,
0x80, 0x99, 0xF1, 0xF2,
0xF3
};
I been trying with some like this:
Code:
string sento;
sento=HexToAscii('02 01 EF 05 31 00 01 00 20 F9 06 02 01 EF 05 33')
nBytesSent = send(Socket, sento.data(), sizeof(sento), 0);
And works, but the other side, all the hex data over 79 change... EF >> 6F... check this:
send: 02 01 EF 05 31 00 01 00 20 F9 06 02 01 EF 05 33
recv : 02 01 6F 05 31 00 01 00 20 79 06 02 01 6F 05 33
...dunno why. With C_Str si the same. I did the same code in Delphi and works perfect... but in C++ i cant. The problem is when i send !
How can i send the value of "info[]" or correct my program?
Your Answer:
Login to answer
151
36
Other forums
User feedback after MySQL query has been executed
Hi all, I've just registered on PHPFreaks because I've got a question that I simply can't work out b
[Need Help] php timing issues
I don't know what is going wrong. I need some help with being able to set an image at 9:00am Colorad
ALV List Display to point to another report on Double Click
Hi,
I want my ALV List Display to point to another report on Double Click on its line ite
Inserting a check in checkbox from array value
Hello all,
I have a bit of code that works for a select option box, but does not work for my chec
Significance of BPM
Hi Experts,
I am a novice in BPM , I just want to know how BPM as permenant department is
Using Windows message as a Handle
Hi,
I am writing one of my first multithreaded programs.
In one of the thread,
Formatting echo from database
So I have a database that stores First and last names, then echos them back to a website, as of now
Remove values in array2 from array1
I have two arrays.
Array 1 is where the array key holds various different numbers. For exampl
Help with php code
Hello, can anyone tell me why this php word trap fails to work,
and the trigger words get blow r
Open/Close Links in Php
Hello, Hoping someone can inform me how I can get PHP to automatically open a set of links in a new