Got it I was missing the below:
#ifdef _WIN32
#define __attribute__(x)
#pragma pack(push, 1)
#ifdef _WIN32
#pragma pack(pop)
#endif
for now in the function i have
int nFreq;
#define COMM_SET_FREQ ((unsigned char) 0x01)
#ifdef _WIN32
#define __attribute__(x)
#pragma pack(push, 1)
#endif
struct command{
unsigned char cmd;
unsigned int param;
}__attribute__((packed));
#ifdef _WIN32
#pragma pack(pop)
#endif
void sendCommand(unsigned char cmds, unsigned int parami) {
int left;
int sent;
int retr = 0;
struct command cmd={cmds, htonl(parami)};
left=sizeof(cmd);
while(left >0) {
//start the funtion of winsock dll
int answer;
WSAData wsaData;
WORD DLLVersion;
DLLVersion = MAKEWORD(2,1);
answer = WSAStartup(DLLVersion, &wsaData);
SOCKADDR_IN addr;
int addrlen = sizeof(addr);
//setup socket
SOCKET sConnect;
// internet family of connection oriented socket
sConnect = socket(AF_INET, SOCK_STREAM,NULL);
//configure the strucket it addre
addr.sin_addr.s_addr = inet_addr("127.0.0.1");
//Now we have to retype the faimly
addr.sin_family = AF_INET;
// set port google htons
addr.sin_port = htons(1234);
// no we have to type in the client should connect to tthe server
connect(sConnect, (SOCKADDR*)&addr, sizeof(addr));
answer = send(sConnect, (char*)&cmd+(sizeof(cmd)-left), left, 0);
cout << (char*)&cmd+(sizeof(cmd)-left) <<endl;
closesocket(sConnect);
return;
}
}
Works perfectly. Thanks every one for the help.
---------- Forwarded message ----------
From:
Chris Svendsen <csvendsen2143@gmail.com>
Date: Mon, Mar 25, 2013 at 1:10 PM
Subject: RTL_TCP Commands
To:
osmocom-sdr@lists.osmocom.orgSending commands to RTL_TCP
What format do the commands need to be in order to change the frequency of RTL_TCP.
I have tried the following and the frequency will change but no to the frequency that is expected for example:
This code :
char SET_FREQUENCY[] ={0x01};
string Freq = string(SET_FREQUENCY,1)+"500000000";
answer = send(sConnect,Freq.c_str(),11,0);
Changes the freq to this:
client accepted!
set freq 892350512
ll+, now 1
ll+, now 2
Any help would be greatly appreciated as i have been stuck on this for days.
Thanks