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
Getting the full city list from maxminds geoip database
I am suprised I can't find any references to this.
I have maxminds geoip lite installed and i
JSON SORT WITH PHP
I have two products that I want to sort by say "Id:17, value: xxx" using php
The page w
Passing Arguments to execlp()
I'm writing a program that mimics a unix shell. It's supposed to take commands with arguments and ex
How to ask a regex question?
Hi, I thought I'd share some of my insight after seeing too many bad questions that either get ignor
MySQL Does not UPDATE- SQLString Problem
vb Syntax (Toggle Plain Text)
1.
SQL = "UPDATE sampletable SET column1 = 'C1sample1'"
error with opendir
when i do this
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($han
Why do I get this error
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/a5488351/public_html/b
Add a sign-up feature to a flat file login script
I'm working on a flat file login script and I would like to add a sign-up feature to it with a email
How to generate a random array of integers subject to a certain constraint
I am writing a program that asks the user to enter an integer N and then generates a random array of
understanding functions and classes
Code: [Select]
class person {
var $name = "Jimmy Goe";
function get_nam