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
Opening Multiple Files/Links in Order.
I want to open links in order/one-by-one and check each for a specific string.
Example:
I
PDO returns erroneous columns from within pdt
Hi All,
This is a truly weird behavior:
When using a simple pdo fetch, erroneous columns a
foreach and array need help combining
Hi guys.
Here's the code
Code: array(
'tag' => 'code',<
Auto-populating dropdowns and multiple forms.
Here's what I have so far:
First drop down = select a state (works)
This populates the sec
styling a RadioButtonList
HiI need to have a radio button and close to it, its lable, then a space then another set of those.
Help with explandable category tree
I have the below query:
SELECT l1.id as lev1_id,l2.id as lev2_id,l3.id as lev3_id,l1.categ
asp authentication problem
Hello all,
I want to use the asp authentication (from asp.net configuration) in my web site. there
Help Optimizing code
Good Morning,
I wrote a small import function for a website of mine and I know there has to b
Database connection failure
Hello All,
I am trying to create new connection to Oracle DB 10.1,
I could not see a
rename the file
File.txt
Code: ***DOCUMENT***
..DN:
000044255
..CB:
..SN:
..PY:
2009
..E