PrnESock
PrnESock allows an application to use TCP/IP network under the Series 60 SDK emulator on PC.
Introduction
The Symbian Series 60 SDK emulator provides a full target environment, which runs under Windows on a PC. Typically, Symbian developers are interested in working with Web, WAP, email, and fax services however, there are issues regarding debugging such applications. According to Symbian the emulator's networking facilities are not designed to work with PC-based LAN networking.
The standard solution proposed by Symbian is comprised of 1) using a PC with 2 physical COM-ports, 2) setting up Windows RAS on one of the ports, 3) configuring the Emulator connections so that it will use another COM port and 4) connecting the ports with a null-modem cable.
Limitations encountered in the above solution include:
Most desktop PCs come with only one serial port;
A special null-modem cable is required;
Since the COM-ports are occupied, they become unusable for any other purpose;
Configuring Windows RAS service may not be simple; and
The connection over RAS will take about half a minute to be established
Realizing the above issues, Symbian Ltd. provides a plug-in for connecting UIQ (Symbian OS v7.0) emulator to the internet, however there is no such solution available for Symbian OS v6.1.
PrnESock is an extremely useful software plug-in solution overcoming inherent limitations associated with connecting Symbian OS v6.1 to the internet.
Installation
PrnESock installation is simple:
unpack PrnESock.DLL and PrnESock.LIB files into your emulator binaries directory (typically %EPOCROOT%Epoc32\Release\wins\UDEB, e.g. C:\Symbian\6.1\Series60\Epoc32\Release\wins\UDEB).
That's all.
How to use
Simply change your MMP file to use PrnESock.LIB instead of ESOCK.LIB.
If you want to keep the same MMP file usable for emulator and target platform build, then remove "LIBRARY esock.lib" and add instead:
LIBRARY prnesock.lib
#else
LIBRARY esock.lib
#endif
Now use the regular Symbian build process (makmake, bldfiles, or any other way you use to create your build environment from MMP file).
That's all.
Technical Principles
Networking architecture of Symbian OS is comprised of several layers between the application and network bearer. PrnESock doesn't deal with all those layers.
In fact PrnESock has re-implemented RSocket and RHostResolver classes, while all other exported function are just stubs, immediately jumping to the correspondent functions of the original ESOCK.DLL.
Thus the applications, which are supposed to work with the ESOCK.DLL, will continue to do so. The applications build with PrnESock.LIB will work with PrnESock's implementation of those 2 classes only, while all other functions will behave exactly as they are from the original ESOCK.DLL (in fact PrnESock.DLL loads the original ESOCK.DLL and delegates those functions to their original implementation).
Public Domain Version Limitations
The public domain version of PrnESock has the following limitations:
Don't rely on inheritance of RSocket and RHostResolver classes from other Symbian classes (namely RSubSessionBase). This means that methods of the base class (e.g. CloseSubSession()) called on instances of RSocket and RHostResolver will produce unpredictable results. This is because the internal data of the classes completely differs from the original implementation.
RSocket does not support the following methods:
TInt Listen(TUint qSize,const TDesC8& aConnectData)
void Accept(WinRSocket& aBlankSocket,TDes8& aConnectData,TRequestStatus& aStatus)
void Connect(TSockAddr& anAddr,const TDesC8& aConnectDataOut,TDes8& aConnectDataIn,TRequestStatus& aStatus)
void RecvFrom(TDes8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen)
void SendTo(const TDesC8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus)
void SendTo(const TDesC8& aDesc,TSockAddr& anAddr,TUint flags,TRequestStatus& aStatus,TSockXfrLength& aLen)
void Shutdown(RSocket::TShutdown aHow,const TDesC8& aDisconnectDataOut,TDes8& aDisconnectDataIn,TRequestStatus& aStatus)
TInt SetOpt(TUint anOptionName,TUint anOptionLevel,TInt anOption)
TInt GetOpt(TUint anOptionName,TUint anOptionLevel,TInt &anOption)
TInt GetDisconnectData(TDes8& aDesc)
void LocalName(TSockAddr& anAddr)
TUint LocalPort()
TInt Info(TProtocolDesc& aProtocol)
TInt Name(TName& aName)
TInt Transfer(RSocketServ& aServer, const TDesC& aName)
An attempt to use them will panic the application with code KErrNotSupported.
RHostResolver does not support the following methods:
TInt Next(TNameEntry& aResult)
void GetByAddress(const TSockAddr& anAddr,TNameEntry& aResult,TRequestStatus& aStatus)
TInt GetHostName(TDes& aName)
void GetHostName(TDes& aName,TRequestStatus &aStatus)
TInt SetHostName(const TDesC& aName)
An attempt to use them will panic the application with code KErrNotSupported.
RSocket supports only:
a) KAfInet address family
b) KSockStream and KSockDatagram socket types
c) KProtocolInetIcmp, KProtocolInetTcp and KProtocolInetUdp protocols
RSocket::Ioctl() method supports KIoctlTcpNotifyDataSent command only. An attempt to use any other command will result in KErrGeneral return value.
RSocket::SetOpt() method supports KSONonBlockingIO, KSOBlockingIO, KSoInetEnumInterfaces, KSORecvBuf and KSOSendBuf options only. (KSORecvBuf and KSOSendBuf options are dummy and don't influent to RSocket work.) An attempt to use any other option will result in KErrGeneral return value.
RSocket::GetOpt() method supports KSoInetNextInterface option only. An attempt to use any other option will result in KErrGeneral return value.
Contact Information
Download from Peroon web site
For any questions and inquires for additional functionality please send email to support@peroon.com.
Copyright Disclaimer
Copyright 2003 Peroon R&D Ltd.
Permission to use, copy, modify, and distribute, this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of the copyright holders be used in advertising or publicity pertaining to distribution of the software with specific, written prior permission, and that no fee is charged for further distribution of this software, or any modifications thereof. The copyright holder makes no representations about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
THE COPYRIGHT HOLDER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA, PROFITS, QPA OR GPA, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.






> PrnESock
This works great! =)
I was able to connect to my localhost server running on win2000.
I tested it with Series60 SocketExample by replacing esocket.lib with prnesocket.lib from .mmp-file and copying prnesocket.lib into libdir.
> PrnESock
Hey .. I used the PrneSock tool .. I unzipped the files in the emulator binaries and modified the mmp files but alas when i ran the socket example which comes with series 60 platform sdk it gives conn err -2 ..
pls help . Rakesh
> PrnESock
Hey .. I used the PrneSock tool .. I unzipped the files in the emulator binaries and modified the mmp files but alas when i ran the socket example which comes with series 60 platform sdk it gives conn err -2 ..
pls help . Rakesh
> PrnESock
Got the same problem. What is error -2?
thanx
> PrnESock
Hi, The Socket example that comes with SDK is an asynchonous socket. It will connect to asynchornouse socket server. So your server must implement asynchronous socket instead of synchronouse socket.
For example Asychronous socket server can be implemented by using CSocket MFC class.
I too was getting the same error (-2) when try to connect to my own server but I could successfully connect to my own server when I changed the implementation of my own server to Asynchronouse Server.
Hope this helps.
> PrnESock
Here's a tutorial, that'll give you all the Standard E32 error codes. (below)
KErrGeneral -2 “General (unspecified) error”
> PrnESock
Hi I tried the same stuff. Installing IBM HTTP Server on my laptop and running http server on port 80.
I am trying to connect the Socket Example on this server using prnesocket.lib . But still getting error.
> PrnESock
Thank you! It works really great and has helped me very much. I have found one little problem though. When I get KErrEof status after calling the RSocket::RecvOneOrMore method, the data buffer contains the content it was containing before calling the RecvOneOrMore. On a real device, the buffer is empty (tested on Nokia 3650, 7650, 3660 and 6600 and SE P800). But it doesn't matter too much since it is OK to check for the KErrEof status and not to try getting the data in such case. At the other hand, it is inconsistent with the real device behavior.
Best regards,
Jan Vorlicek
> PrnESock
Hi,
Does anybody used prnesock within the server. I have a miniserver in the application and any RSocket call fails, starting from Open(). I am using the supported functions from RSocket. Note: the same code works if it is within the application (.app) using prnesock.
Srecko
> PrnESock
Hi,
I have tried to use the PrnESock library but got the error = -2 when I tried to connect to my server. It seems other people have the same problem. Has anyone found a solution?
Regards
Hans
Error: SOCKET[4620] is not in KSocketCommandRecv state
Can someone tell me what I've done wrong if this appears in the debug output: "Error: SOCKET[4620] is not in KSocketCommandRecv state"
However, everything works fine but the warning message indicates I've made a mistake somewhere.
Basically I read from socket with Recv & CActive object and request more data inside RunL..
> Error: SOCKET[4620] is not in KSocketCommandRecv state
Socket servers are possible?
Similar lib for BT?
I'd be very happy if a similar tool would be available for BT development also! No matter how much it would cost!
..and preferably also for Series60 2.0 and 2.1.
> Similar lib for BT?