<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss">
 	<channel>
		<title>PocketCNetLib | VisualNewt Software | Serg Koren</title>
		<link>http://www.visualnewt.com/Products/palmos/pocketcnetlib/</link>
		<description></description>
		<language>en</language>
		<lastBuildDate>Sat, 16 Feb 2008 20:18:25 -0500</lastBuildDate>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<generator>Sandvox Pro 1.2.6</generator>
		<image>
			<url>http://www.visualnewt.com/_Media/vns_rss.jpeg</url>
			<title>VisualNewt Software Logo</title>
			<link>http://www.visualnewt.com/Products/palmos/pocketcnetlib/</link>
			<width>144</width>
			<height>56</height>
		</image>
		<item>
			<title>PocketCNetLib Sample Code</title>
			<link>http://www.visualnewt.com/Products/palmos/pocketcnetlib/pocketcnetlib_sample_code.html</link>
			<description>
&lt;p&gt;&lt;span style=&quot;font-family: Times; font-size: 16px;&quot;&gt;&lt;blockquote&gt;&lt;h1 style=&quot;color: rgb(214, 236, 174); font-family: 'Trebuchet MS'; font-size: 32px; text-align: center;&quot;&gt;&lt;b&gt;PocketCNetLib API Test Program 1.0.0&lt;/b&gt;&lt;/h1&gt;
&lt;p&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;
© 2003 Serg Koren &amp;amp; VisualNewt Sofware. &lt;br /&gt;
All rights reserved.&lt;/p&gt;
&lt;hr style=&quot;text-align: left;&quot; /&gt;
&lt;pre style=&quot;text-align: left; font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;&lt;div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;// PocketCNetLib test
// This is a simple PocketC program to test the PocketCNetLib.
// PocketCNetLib is a native library that allows PocketC to connect to the internet.
//
// PocketCNetLib
// VisualNewt Software
// http://www.VisualNewt.com/
// Serg@VisualNewt.com
//
// PocketCNetLib is (c) 2003 Serg Koren &amp;amp; VisualNewt Software.
//	All rights reserved.
// PocketCNetLib is $10.
//
// use the 'library' statement to get access to the library
library &quot;PocketCNetLib&quot;
// app stuff
@cid &quot;VNNL&quot;;
@name &quot;PocketCNetLib test&quot;;
@dbname &quot;PCNL test&quot;;
@ver &quot;1.0.0&quot;;
// globals
int refnum;
int socketrefnum;
int err;
// For returned strings...some of the library calls return a pointer to a string.
pointer p;
@doc &quot;Translate an error code into a string.&quot;;
ConvertError(int err)
{
		// pass in the error code returned by the library
		p = nlErrorString(err);
		puts(*p + &quot; &quot; + (err - 5000) +  &quot;\n&quot;);
		alert(*p + &quot; &quot; + (err - 5000));
		exit();
}
@doc &quot;Releases the NetLib&quot;;
CleanupLibrary()
{
		// close the library
		err = nlNetLibClose(refnum,0);
		if (err &amp;gt; 5000)
		{
			ConvertError(err);
		}
		puts(&quot;Library closed\n&quot;);
}
@doc &quot;Gets a reference to the NetLib and opens it.&quot;;
SetupLibrary()
{
		// get the refnum to library
		refnum =  nlGetNetLibNumber();
		if (err &amp;gt; 50000)
		{
			ConvertError(refnum);
		}
		puts(&quot;NetLib Reference number: &quot; + refnum + &quot;\n&quot;);
		// set timeout to 5 seconds
		err = nlSetAppNetTimeout(5);
		if (err &amp;gt; 5000)
		{
			CleanupLibrary();
			ConvertError(err);
		}
		puts(&quot;Timeout set\n&quot; );
		// open the library
		err = nlNetLibOpen(refnum);
		if (err &amp;gt;  5000)
		{
         	CleanupLibrary();
			ConvertError(err);
		}
		puts(&quot;Library opened\n&quot;);
}
@doc &quot;Opens a socket.&quot;;
ObtainSocket()
{
		// open a socket
		socketrefnum  = nlNetLibSocketOpen(refnum,2,1,5000);
		if (socketrefnum &amp;gt; 5000)
		{
			CleanupLibrary();
			ConvertError(err);
		}
		puts(&quot;Socket number : &quot; + socketrefnum + &quot;\n&quot;);
}
@doc &quot;Closes the socket.&quot;;
ReleaseSocket()
{
		// close the socket
		err = nlNetLibSocketClose(refnum,socketrefnum,5000);
		if (err &amp;gt; 5000)
		{
			CleanupLibrary();
			ConvertError(err);
		}
		puts(&quot;Socket closed.\n&quot;);
}
@doc &quot;Connects to either the dottedIP or host name at the specified port.&quot;;
ConnectSocketToAddress(string dottedIP, string port)
{
		string buf = dottedIP;
		buf = buf + &quot; translated to &quot;;
		// Get a socket reference number by opening a socket
		ObtainSocket();
		// look up our test DNS name's IP address...
		puts(&quot;Checking &quot; + dottedIP + &quot;\n&quot;);
		// see if the first char is a number...if so it's a dotted IP, otherwise its a DNS name;
		// if its a DNS name we need to get the dotted IP equivalent.
		dottedIP = strlwr(dottedIP);
		if ((dottedIP@[0] &amp;gt;= &quot;a&quot;) &amp;amp;&amp;amp; (dottedIP@[0] &amp;lt;= &quot;z&quot;))
		{
			p = nlNetLibGetHostByName(refnum,dottedIP,5000);
			puts(dottedIP + &quot; - &quot; + *p + &quot;\n&quot;);
			// length of 4 indicates an error code
			if (strlen(*p) == 4)
			{
				// convert the error in string form to an interger
				err = *p;
				ReleaseSocket();
				CleanupLibrary();
				ConvertError(err);
			}
		}
		// connect the socket
		// note you can also just pass in the DNS name instead of the IP address.
		// ( www.visualnewt.com instead of xxx.xxx.xxx.xxx since nlNetLibSocketConnect
		//   does its own NetLibGetHostByName if needed.)
		err = nlNetLibSocketConnect(refnum,socketrefnum,*p,port,5000);
		if (err == 5003)
		{
			// The demo library is locked into www.visualnewt.com
			alert(&quot;This is a demo copy of PocketCNetLib: &quot; + (err - 5000));
			puts(&quot;This is a demo copy!\n&quot;);
			ReleaseSocket();
			CleanupLibrary();
			exit();
		}
		else if (err &amp;gt; 5000)
		{
			ReleaseSocket();
			CleanupLibrary();
			ConvertError(err);
		}
		puts(&quot;Socket connected: &quot; + *p + &quot;:&quot; + port + &quot;\n&quot;);
}
@doc &quot;Sends the specified data to our socket.&quot;;
SendData(string what)
{
		err = nlNetLibSend(refnum,socketrefnum,what,0,&quot;&quot;,&quot;&quot;,5000);
		if (err &amp;gt; 5000)
		{
			ReleaseSocket();
			CleanupLibrary();
			ConvertError(err);
		}
		puts(&quot;Socket sent data! Bytes: &quot; + err + &quot;\n&quot;);
}
@doc &quot;Receives data from our socket.&quot;;
GetData()
{
 		puts(&quot;Receiving response.\n&quot;);
		p =  nlNetLibReceive(refnum,socketrefnum,0,5000);
		// length of 4 indicates an error code
		if (strlen(*p) == 4)
		{
			// convert error in string form to integer
			err = *p;
			ConvertError(err);
		}
		puts(&quot;RECEIVED:\n&quot;);
		puts (*p + &quot;\n&quot;);
		puts(&quot;END RECEIVED\n&quot;);
}
@doc &quot;Make sure the NetLib is installed.&quot;;
CheckAvailability()
{
		err = nlCheckInstalled();
		if (err &amp;gt; 5000)
		{
			alert(&quot;NetLib not installed or available: &quot; + (err - 5000));
			puts(&quot;NetLib not installed or available: &quot; +  (err - 5000));
			exit();
		}
		puts(&quot;NetLib is available.\n&quot;);
}
// The main routine
// 	This is structured into high-level functionality.
@doc &quot;Main routine.&quot;;
main()
{
		// Clear the output
		clear();
		// Display a title with the PocketCNetLib version.
		// It should not return a 0
		p = nlVersion();
		if (*p == 0)
		{
			alert(&quot;Cannot connect to library.&quot;);
			exit();
		}
		title(&quot;PocketCNetLib Test - &quot; + *p);
		puts(&quot;Version: &quot; + *p + &quot;\n&quot;);
		// Make sure the NetLib is installed and available.
		CheckAvailability();
		// Set up the Net library
		SetupLibrary();
		// Connect a socket to an address, port number
		// The demo library only connects to www.visualnewt.com
		// Register to get an unlocked version.
		ConnectSocketToAddress(&quot;www.VisualNewt.com&quot;,&quot;80&quot;);
		// Now send data to our socket -- in this case we call a web page
		SendData(&quot;GET /Products/Palm/PocketCNetLIb/test.html HTTP/1.0\r\n\r\n&quot;);
		// Receive data from our socket
		GetData();
		// Close the socket we have open
		ReleaseSocket();
		// Tear down the Net library
		CleanupLibrary();
		puts(&quot;Done!&quot;);
		alert(&quot;Done!&quot;);
}
		&lt;/div&gt;
&lt;/div&gt;
&lt;/tt&gt;&lt;/pre&gt;
&lt;p style=&quot;text-align: left;&quot;&gt; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote style=&quot;text-align: left;&quot;&gt;&lt;hr style=&quot;text-align: left;&quot; /&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;Support:&lt;/b&gt;&lt;/h2&gt;
&lt;p&gt;PocketCNetLib support is a development tool. As such, only the tool is supported, not any code you attempt to develop using the tool. It is up to you to determine whether the problem is in your code or the library's. Support will be provided to registered users only, and priority will be given to registered users for enhancement requests.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Bugs and enhancement requests should be sent to: &lt;a href=&quot;mailto:Serg@VisualNewt.com&quot;&gt;Serg@VisualNewt.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;/span&gt;&lt;/p&gt;
			</description>
			<pubDate>Mon, 09 Apr 2007 14:25:58 -0400</pubDate>
			<guid>http://www.visualnewt.com/Products/palmos/pocketcnetlib/pocketcnetlib_sample_code.html</guid>
		</item>
		<item>
			<title>PocketCNetLib Documentation</title>
			<link>http://www.visualnewt.com/Products/palmos/pocketcnetlib/pocketcnetlib_documentation.html</link>
			<description>
&lt;p&gt;&lt;span style=&quot;font-family: Times; font-size: 16px;&quot;&gt;&lt;blockquote&gt;&lt;h1 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 32px;&quot;&gt;&lt;b&gt;PocketCNetLib API 1.0.0&lt;/b&gt;&lt;/h1&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
© 2003 Serg Koren &amp;amp; VisualNewt Sofware. &lt;br /&gt;
All rights reserved.&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;The following NetLib API calls are supported internally by the library:&lt;br /&gt;
&lt;/p&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;NetLibReceive&lt;/li&gt;
&lt;li&gt;NetLibGetHostByName&lt;/li&gt;
&lt;li&gt;NetLibSend&lt;/li&gt;
&lt;li&gt;NetLibSocketConnect&lt;/li&gt;
&lt;li&gt;NetLibSocketClose&lt;/li&gt;
&lt;li&gt;NetLibSocketOpen&lt;/li&gt;
&lt;li&gt;NetLibClose&lt;/li&gt;
&lt;li&gt;NetLibOpen&lt;/li&gt;
&lt;li&gt;SetAppNetTimeout&lt;/li&gt;
&lt;li&gt;GetNetLibNumber&lt;/li&gt;
&lt;/ul&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
(others will be added as requested by registered users.)&lt;br /&gt;
&lt;br /&gt;
The PocketCNetLib API calls (exposed to PocketC) include:&lt;br /&gt;
&lt;/p&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlVersion&quot;&gt;nlVersion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlCheckInstalled&quot;&gt;nlCheckInstalled&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlGetNetLibNumber&quot;&gt;nlGetNetLibNumber&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlErrorString&quot;&gt;nlErrorString&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlNetLibOpen&quot;&gt;nlNetLibOpen&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlNetLibGetHostByName&quot;&gt;nlNetLibGetHostByName&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlNetLibSocketConnect&quot;&gt;nlNetLibSocketConnect&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlNetLibSocketOpen&quot;&gt;nlNetLibSocketOpen&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlNetLibSend&quot;&gt;nlNetLibSend&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlNetLibReceive&quot;&gt;nlNetLibReceive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlNetLibSocketClose&quot;&gt;nlNetLibSocketClose&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlNetLibClose&quot;&gt;nlNetLibClose&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/Documentation.html#nlSetAppNetTimeout&quot;&gt;nlSetAppNetTimeout&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;See the &lt;a href=&quot;file:///Users/sk/Desktop/VN%20site/Web%20Devil%20Downloads/www.visualnewt.com/Products/Palm/PocketCNetLIb/NetLibtest.html&quot;&gt;example test program&lt;/a&gt; for a complete example of the API's use.&lt;/p&gt;
&lt;hr style=&quot;text-align: left;&quot; /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlVersion&quot;&gt;&lt;/a&gt;pointer nlVersion();&lt;/b&gt;&lt;/h2&gt;
&lt;h4 style=&quot;text-align: left;&quot;&gt;parameters:&lt;/h4&gt;
&lt;blockquote style=&quot;text-align: left;&quot;&gt;&lt;p style=&quot;text-align: left;&quot;&gt;&amp;lt;none&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;Returns the version number of the PocketCNetLib. The return is a pointer to a string.&lt;/p&gt;
&lt;blockquote style=&quot;text-align: left;&quot;&gt;&lt;pre style=&quot;text-align: left; font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;pointer p;&lt;/tt&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;p = nlVersion();&lt;/tt&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;alert(*p);
&lt;/tt&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;pre style=&quot;text-align: left; font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;&lt;div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;/tt&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;hr style=&quot;text-align: left;&quot; /&gt;
&lt;blockquote style=&quot;text-align: left;&quot;&gt;&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlCheckInstalled&quot;&gt;&lt;/a&gt;int nlCheckInstalled();&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;lt;none&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Returns 5000 if NetLib is installed on the device, otherwise returns an error code which can be passed to nlErrorString.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlGetNetLibNumber&quot;&gt;&lt;/a&gt;int nlGetNetLibNumber();&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;lt;none&amp;gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Returns the NetLib reference number, otherwise returns an error code which can be passed to nlErrorString.&lt;/p&gt;
&lt;p&gt;Note: the reference number will be less than 5000, while an erro code will be greather than 5000.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlErrorString&quot;&gt;&lt;/a&gt;pointer nlErrorString(int errorCode);&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;integer error code obtained from PocketCNetLib&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Accepts an error code as returned by PocketCNetLib, and returns a pointer to the corresponding error string. &lt;strong&gt;NOTE&lt;/strong&gt;: Do not pass non PocketCNetLib errors into this routine. PocketCNetLib error codes start at 5000. To get the corresponding PalmOS NetLib errror code merely subtract 5000 from the PocketCNetLib error code. That is:&lt;/p&gt;
&lt;p&gt;PalmOS NetLib error code = PocketCNetLib error code - 5000;&lt;/p&gt;
&lt;blockquote&gt;&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;pointer p;&lt;/tt&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;p = nlErrorString(5122);&lt;/tt&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;alert(*p);
&lt;/tt&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlNetLibOpen&quot;&gt;&lt;/a&gt;int nlNetLibOpen(int refNum);&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;integer NetLib reference number&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Opens the NetLib given its reference number (obtained via nlGetNetLibNumber). Returns 5000 if successful, otherwise returns an error code that can be passed to nlErrorString.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlNetLibGetHostByName&quot;&gt;&lt;/a&gt;pointer nlNetLibGetHostByName(int refNum,string hostName,int timeout);&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;integer NetLib reference number&lt;/p&gt;
&lt;p&gt;string host name to be translated&lt;/p&gt;
&lt;p&gt;integer timeout in seconds&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Translates a host name to a TCP/IP dotted-IP address of the form xxx.xxx.xxx.xxx. Returns a pointer to a string that eitherrepresents the dotted IP address or a 5000-based error code that can be passed to nlErrorString after conversion to an integer.&lt;/p&gt;
&lt;blockquote&gt;&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;string host;
pointer p;&lt;/tt&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;host = &quot;www.palmsource.com&quot;;
p = nlNetLibGetHostByName(refnum,host,5);
puts(host + &quot; - &quot; + *p + &quot;\n&quot;);
// length of 4 indicates an error code
if (strlen(*p) == 4)
{&lt;/tt&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;    //handle errors here&lt;/tt&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;}&lt;/tt&gt;&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlNetLibSocketConnect&quot;&gt;&lt;/a&gt;int nlNetLibSocketConnect(int refNum,int socketNum,string host,string port,int timeout);&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;integer NetLib reference number&lt;/p&gt;
&lt;p&gt;integer socket reference number obtained from nlNetLibSocketOpen&lt;/p&gt;
&lt;p&gt;string host name &lt;strong&gt;OR&lt;/strong&gt; dotted IP address&lt;/p&gt;
&lt;p&gt;string timeout in seconds&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Attempts to connect to the specified host-port combination given the NetLib and socket reference numbers. This call will accept either a dotted IP address in the form of &quot;255.255.255.255&quot; or a host name &quot;www.mysite.com&quot;, and will do an internal name to IP address lookup if necessary. Returns 5000 if the connection succeeds, otherwise it returns an error code that can be passed to nlErrorString.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;: The demo version of PocketCNetLib will return an error code 5003 if the host or IP address maps to something other than www.visualnewt.com. That is, the demo will only connect to www.visualnewt.com.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlNetLibSocketOpen&quot;&gt;&lt;/a&gt;int nlNetLibSocketOpen(int refNum,int domain, int type, int timeout);&lt;/b&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;parameters:&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;integer NetLib reference number&lt;/p&gt;
&lt;p&gt;integer domain   0, or 2 (see PalmOS NetSocketAddrEnum documentation). You will usually use 2.&lt;/p&gt;
&lt;p&gt;integer type 1,2,3,4 (see PalmOS NetSocketTypeEnum documentation). You will usually use 1.&lt;/p&gt;
&lt;p&gt;integer timeout in seconds&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Obtains a socket and attempts to open it. If successful, nlNetLibSocketOpen returns a socket reference number,otherwise a 5000-based error code that can be passed to nlErrorString.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlNetLibSend&quot;&gt;&lt;/a&gt;nlNetLibSend(int refNum, int socketNum, string buffer, string dottedIP, string port, int timeout);&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;integer NetLib reference number&lt;/p&gt;
&lt;p&gt;integer socket reference number&lt;/p&gt;
&lt;p&gt;string buffer to transmit (&lt;strong&gt;NOTE&lt;/strong&gt;: This buffer is limited to 2048 bytes within PocketCNetLib.)&lt;/p&gt;
&lt;p&gt;string dotted IP address of the host to send to or &quot;&quot; if you wish to send to the currently open socket. (&lt;strong&gt;NOTE&lt;/strong&gt;: This call does not resolve host names.)&lt;/p&gt;
&lt;p&gt;string port to send to or &quot;&quot; if you wish to send to the currently open socket.&lt;/p&gt;
&lt;p&gt;integer timeout in seconds&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Attempts to send a string buffer of data to the previously opened socket, or to the specified dotted IP address and port combination. Set the dotted IP and port numbers to &quot;&quot; to specify the previously opened socket. Returns the total number of bytes sent or a 5000 based error code that can be passed to nlErrorString.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlNetLibReceive&quot;&gt;&lt;/a&gt;pointer nlNetLibReceive(int netRef, int socketNum, int flags, int timeout);&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;integer NetLib reference number&lt;/p&gt;
&lt;p&gt;integer socket reference number&lt;/p&gt;
&lt;p&gt;integer flags 0. (See PalmOS I/O Flags Documentation).&lt;/p&gt;
&lt;p&gt;integer timeout in seconds&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Reads data from the previously opened socket and returns a pointer to the data. Returns a pointer to a 5000 based string error code. This must be converted to an integer to be passed to nlErrorString.&lt;/p&gt;
&lt;blockquote&gt;&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;int err;&lt;/tt&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;pointer p; &lt;/tt&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-family: Courier; font-size: 13px; white-space: pre;&quot;&gt;&lt;tt&gt;p = nlNetLibReceive(refnum,socketrefnum,0,5);
// length of 4 indicates an error code
if (strlen(*p) == 4)
{
// convert error in string form to integer
   err = *p;
   p = nlErrorString(err);
   alert(*p);
}
puts(&quot;RECEIVED : &quot; + *p + &quot;\n&quot;);&lt;/tt&gt;&lt;/pre&gt;
&lt;p&gt; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlNetLibSocketClose&quot;&gt;&lt;/a&gt;int nlNetLibSocketClose(int refNum, int socketNum, int timeout);&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;integer NetLib reference number&lt;/p&gt;
&lt;p&gt;integer socket reference number&lt;/p&gt;
&lt;p&gt;integer timeout in seconds&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Attempts to close the socket number specified. Returns 5000 if successful, or an error code that can be passed to nlErrorString.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlNetLibClose&quot;&gt;&lt;/a&gt;int nlNetLibClose(int refNum, int closeMode);&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;integer NetLib reference number&lt;/p&gt;
&lt;p&gt;integer 0 = use timed close, 1 = close immediately (see PalmOS NetLib documentation).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Closes the NetLib. Returns 5000 if successful, or a 5000 based error code that can be passed to nlErrorString.&lt;/p&gt;
&lt;hr /&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;&lt;a name=&quot;nlSetAppNetTimeout&quot;&gt;&lt;/a&gt;int nlSetAppNetTimeout(int timeout);&lt;/b&gt;&lt;/h2&gt;
&lt;h4&gt;parameters:&lt;/h4&gt;
&lt;blockquote&gt;&lt;p&gt;integer timeout in seconds&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Sets the AppNetTimeout variable that determines the application's timeout on network activity. See PalmOS NetLib documentation for more information. This call always returns 5000 (success).&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h2 style=&quot;text-align: left; color: rgb(214, 236, 174); font-family: Trebuchet MS; font-size: 24px;&quot;&gt;&lt;b&gt;Support:&lt;/b&gt;&lt;/h2&gt;
&lt;p&gt;PocketCNetLib support is a development tool. As such, only the tool is supported, not any code you attempt to develop using the tool. It is up to you to determine whether the problem is in your code or the library's. Support will be provided to registered users only, and priority will be given to registered users for enhancement requests.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Bugs and enhancement requests should be sent to: &lt;a href=&quot;mailto:Serg@VisualNewt.com&quot;&gt;Serg@VisualNewt.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;h2 style=&quot;color: rgb(214, 236, 174); font-family: 'Trebuchet MS'; font-size: 24px; text-align: center;&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/h2&gt;
&lt;/blockquote&gt;
&lt;/span&gt;&lt;/p&gt;
			</description>
			<pubDate>Mon, 09 Apr 2007 14:24:08 -0400</pubDate>
			<guid>http://www.visualnewt.com/Products/palmos/pocketcnetlib/pocketcnetlib_documentation.html</guid>
		</item>
 	</channel>
</rss>
