I've been trying to issue a POST request from the Palm VII (emulator) using
INetLib. On the server side, I receive the header, but not the message body
(just two CRLFs).
I've provided my code below - can anyone see what I'm doing wrong?
Here's my code:
// Specify the configuration to use for INetLib. We'll be supplied
// with an index, which we'll then use to set the configuration.
Word configIndex = 0;
INetConfigNameType configNameStruct;
StrCopy(configNameStruct.name, inetCfgNameDefWireless);
result = INetLibConfigIndexFromName(
g_INetLibRef,
&configNameStruct,
&configIndex);
// ...
result = INetLibOpen(
g_INetLibRef,
configIndex,
0,
NULL,
0,
&g_inetHandle);
// ...
// Connect /////////////////////////////////////////////
CharPtr myHostAddrA = "192.168.1.246"; // my machine
result = INetLibSockOpen(
g_INetLibRef,
g_inetHandle,
inetSchemeHTTP,
&g_sockHandle);
result = INetLibSockConnect(
g_INetLibRef,
g_sockHandle,
(BytePtr)myHostAddrA,
80, // port
-1); // don't timeout.
/////////////////////////////////////////////////////////
// Format and send an HTTP post request
result = INetLibSockHTTPReqCreate(
g_INetLibRef,
g_sockHandle,
(Byte*)"POST",
(Byte*)"http://192.168.1.246/test",
NULL);
const int cHttpBodyBytes = 200;
CharPtr pHttpBody = (CharPtr)MemPtrNew(cHttpBodyBytes);
if (pHttpBody != NULL)
{
MemSet(pHttpBody, MemPtrSize(pHttpBody), (Byte)0);
StrCopy(pHttpBody, "name1=value1");
const DWord dwActualBytes = StrLen(pHttpBody);
// Send the request ...
result = INetLibSockHTTPReqSend(
g_INetLibRef,
g_sockHandle,
pHttpBody,
dwActualBytes,
-1);
MemPtrFree(pHttpBody);
pHttpBody = NULL;
}
//////////////////////////////////////////////////////
Thanks for any help...
======================================
Jabavu Adams,
Software Developer
724 Solutions Inc (http://www.724.com)