Also, I read the Sample code from INetLow and I could extract the
information I needed. The stucture is too different. Does this sort of
operation require all that complex code? I'm hoping that code was just
to support asynchronous transmission. I don't care about that - not for
now anyway.
I just want to be able to talk to an asp program on our webservers. I
want to send (plaintext) information or requests for (plaintext)
information from the palm to the servers and update the data on the palm
with the responses. Are there any serious holes in this plan?
Jason
-----Original Message-----
From: Jason D. Kleban
Sent: Friday, November 29, 2002 2:53 PM
To: Palm Developer Forum
Subject: Still on the INetLib
This is driving me very insane. I seem to not be correctly initializing
the sockHP. When I run it, I get errors that the lines with sockHP in
it a about trying to access the address that sockHP holds (from the
debugger).
This function is SUPPOSED to take a URL from txtRequest field and put
the txtResponse field. Just that simple. No asynchornous nothing.
This should be simple. Maybe I'm missing a step. Maybe the sockH
should be preallocated with as a NewMemHandle? If that's the answer, I
can't figure that out either.
I did order a bunch of books to compliment the online docs from my boss.
(So I'm not just trying to freeload off here)
Please?
Thanks,
Jason
static Boolean frmMain_btnRequest_OnSelect(EventPtr event)
{
// Note: Form Fields are txtRequest and txtReturn.
// This function activated by pressing btnRequest.
FormType *formPtr; // pointer to current form
UInt16 fieldReturnIndex; // Index of txtReturn
UInt16 fieldRequestIndex; // Index of txtRequest
FieldType *fieldReturnPtr; // * to txtReturn
FieldType *fieldRequestPtr; // * to txtRequest
UInt16 libRefNum; // INetLib Reference Number
UInt16 WirelessConfig; // Wireless Configuration Set
MemHandle inetH; // Handle INetLib
MemHandle* sockHP; // Pointer to Handle of Socket
UInt32 actBytes = 0; // Actual Bytes Read from Socket
Char* serverResponse; // Server Response
Err myError;
// Get a pointer to the active form:
formPtr = FrmGetActiveForm();
// Get the indexes of the fields:
fieldReturnIndex = FrmGetObjectIndex(formPtr, txtReturn);
fieldRequestIndex = FrmGetObjectIndex(formPtr, txtRequest);
// Using the indexes we can get a pointers to the fields:
fieldReturnPtr = (FieldType *) FrmGetObjectPtr(formPtr,
fieldReturnIndex);
fieldRequestPtr = (FieldType *) FrmGetObjectPtr(formPtr,
fieldRequestIndex);
// Open Internet Library
SysLibFind(inetLibName, &libRefNum);
INetLibConfigIndexFromName(libRefNum, (INetConfigNameType*)
inetCfgNameDefWireless, &WirelessConfig);
myError = INetLibOpen(libRefNum, WirelessConfig, 0, NULL, 0,
&inetH);
ErrFatalDisplayIf(myError,"INetLibOpen failed.");
// Open Internet URL
myError = INetLibURLOpen(libRefNum, inetH,
FldGetTextPtr(fieldRequestPtr),
NULL, sockHP, 1500 , 0);
ErrFatalDisplayIf(myError, "INetLibURLOpen can't load page.");
// Get the Site Response
do
{
// Read from the Socket
myError = INetLibSockRead (libRefNum, *sockHP,
serverResponse, 1, &actBytes, 500 );
ErrFatalDisplayIf(myError,"INetLibSockRead failure.");
// Write output to the return field
if (actBytes != 0) FldInsert(fieldReturnPtr,
serverResponse, 1);
} while (actBytes != 0);
//Close the Internet Again
INetLibClose(libRefNum, inetH);
return true;
}
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/