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.
Did you know?Explore Trending and Topic pages for more stories like this.
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
isset undefined variable
Hi all,
Hope someone can point out the obvious. I've a log in script, if you dont enter a use
fire away
i launched about 4 months ago as a lagit co. i have 2 paying clients, 1probono, 1 side progect, and
Multithreading in Oracle (Java, SQLJ, Pro*C,??) on 10g
I am investigating how to run a Java stored procedure in multithread mode.
I know that if I chang
Applet JTextField Size Problem
Hello,
I recently started making an applet to calculate certain values for airplanes. However
How to read CSS message data
Hi,
I have a requirement here. When working as a Dev angel for multiple customers its really di
Collecting AOL Search Terms
I am attempting to collect AOL search terms. I know the code is correct (it works for google, bing,
How to limit the calls to an API
Hello, in my simple script I call an api which effectively involves me getting an xml file.
H
mysql_affected_rows() usage
Possibly a MySQL issue, but the function that is not behaving in the anticipated way is a PHP functi
SAP FICO learning materials
Hi all,
I am new to this world of SAP FICO. I have taken training on SAP FICO, but was wonderin
foreach iterator
Hi Guys
Does the foreach loop have an inbuilt iterator ?