Click here to Skip to main content
11,493,948 members (63,449 online)
Click here to Skip to main content
Add your own
alternative version

Use of free SocketPro package for creating super client and server applications

, 23 Feb 2002 140.5K 5.9K 59
A set of socket libraries for writing distributed computing applications over the internet
socketpro.zip
netdemo
ClientComponents
MultiSvsSample
SvrComponents
bin
include
lib
Samples
client
DnsSvs
GetHTML
InternetIO
MultiSvsSample
SpeedTest
res
DResolver
Svr
NormalApp
NTSvs
help
trash
SecureSocket
SafeSocket
DNSResolver.exe
GetHtml.exe
IONet.exe
MultipleSvs.exe
MultiSvs.exe
MultiSvsClient.exe
NetBaseR.dll
SafeSocket.exe
SecureSocket.exe
SpeedTest.exe
ClientSocket.dll
DResolver.dll
SBroker.dll
SockFile.dll
fundamental.gif
patterns.gif
NetBaseR.lib
DNSResolver
DNSResolver.vbp
DNSResolver.vbw
frmDNSResolver.frm
frmDNSResolver.frx
frmChatClient.frm
frmChatClient.frx
GETHTML.vbp
GETHTML.vbw
iIO.frm
IONet
IONet.vbp
IONet.vbw
frmMultiSvs.frm
frmMultiSvs.frx
MultiSvs.vbp
MultiSvs.vbw
SafeSocket.vbp
SafeSocket.vbw
SecureSocket.frm
SpeedTest.ico
SpeedTest.aps
SpeedTest.clw
SpeedTest.dsp
SpeedTest.dsw
dlldata.obj
DNS.rgs
DResolver.aps
DResolver.def
DResolver.dsp
DResolver.dsw
DResolver.opt
DResolver.plg
DResolver.tlb
DResolverps.def
DResolverps.exp
DResolverps.lib
DResolverps.mk
DResolver_i.obj
DResolver_p.obj
MultipleSvs.dsp
MultipleSvs.dsw
MultiSvs.dsp
MultiSvs.dsw
MultiSvs.rgs
MultiSvs.tlb
MultiSvsps.def
MultiSvsps.mk
dlldata.obj
SafeSocket.aps
SafeSocket.dsp
SafeSocket.dsw
SafeSocket.plg
SafeSocket.rgs
SafeSocket.tlb
SafeSocketps.def
SafeSocketps.dll
SafeSocketps.exp
SafeSocketps.lib
SafeSocketps.mk
SafeSocket_i.obj
SafeSocket_p.obj
SPassword.rgs
MultipleSvs.exe
MultiSvs.exe
NetBaseR.dll
SafeSocket.exe
// SocketClient.idl : IDL source for SocketClient.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (ClientSocket.tlb) and marshalling code.
   
import "oaidl.idl";
import "ocidl.idl";
	
	[
		object,
		uuid(726360BC-AE26-11D5-8A74-002078B038BB),
		dual,
		helpstring("ISktClient Interface"),
		pointer_default(unique)
	]

	interface ISktClient : IDispatch
	{
		[id(1), helpstring("method Connect")] HRESULT Connect([in] BSTR bstrHostAddress, [in] long lHostPort, [in, optional, defaultvalue(0)]VARIANT_BOOL bUseMsgPump, [in, optional, defaultvalue(1)] long lSocketType, [in, optional, defaultvalue(2)] long lAddrFormat, [in, optional, defaultvalue(0)] long lProtocol, [in, optional, defaultvalue("")]BSTR bstrCallerData, [out, optional, defaultvalue(0)]BSTR *pbstrCalleeData, [in, optional, defaultvalue(0)]long lLocalPort);
		[id(2), helpstring("method Disconnect")] HRESULT Disconnect();
		[id(3), helpstring("method ShutDown")] HRESULT ShutDown([in, optional, defaultvalue(1)]long lHow);
		[id(4), helpstring("method RecvChunk")] HRESULT RecvChunk([in, out]long *plLen, [in, optional, defaultvalue(0)]long lFlags, [out, retval]VARIANT *pvtData);
		[id(5), helpstring("method RecvChunkFrom")] HRESULT RecvChunkFrom([in, out]long *plLen, [in, optional, defaultvalue(0)] long lFlags, [out, optional, defaultvalue(0)]BSTR *pbstrSrcAddr, [out, optional, defaultvalue(0)]long *plPort, [out, retval]VARIANT *pvtData);
		[id(6), helpstring("method SendChunk")] HRESULT SendChunk([in]VARIANT vtData, [in, optional, defaultvalue(0)]long lFlags, [out, retval]long *plSent);
		[id(7), helpstring("method SendChunkTo")] HRESULT SendChunkTo([in]VARIANT vtData, [in]long lPort, [in, optional, defaultvalue("")]BSTR bstrAddr, [in, optional, defaultvalue(0)]long lFlags, [out, retval]long *plSent);
		[id(8), helpstring("method AsyncSelect")] HRESULT AsyncSelect([in]long lNewEvent);
		[id(9), helpstring("method SwitchTo")] HRESULT SwitchTo([in]long lClassID);
		[id(10), helpstring("method GetSockAddr")] HRESULT GetSockAddr([out, optional]long *plSocketPort, [out, retval]BSTR *pbstrSockAddress);
		[id(11), helpstring("method IOCtl")] HRESULT IOCtl([in]long lCommand, [in, out]long *plArgment);
		[id(12), helpstring("method GetPeerName")] HRESULT GetPeerName([out, optional]long *plPeerPort, [out, retval]BSTR *pbstrPeerName);
		[id(13), helpstring("method SetSockOpt")] HRESULT SetSockOpt([in]long lOptName, [in]long lOptValue, [in, optional, defaultvalue(0xffff)]short nLevel);
		[id(14), helpstring("method GetSockOpt")] HRESULT GetSockOpt([in]long lOptName, [in, optional, defaultvalue(0xffff)]short nLevel, [out, retval]long *plOptValue);
		[id(15), helpstring("method GetHostByAddr")] HRESULT GetHostByAddr([in]BSTR bstrIPAddr, [in, optional, defaultvalue(2)]long lAddrFormat, [in, optional, defaultvalue(0)]VARIANT_BOOL bBlocking, [out, optional, defaultvalue(0)]long *phHandle, [out, optional, defaultvalue(0)]BSTR *pbstrAlias, [out,retval]BSTR *pbstrHostName);
		[id(16), helpstring("method GetRtn")] HRESULT GetRtn([out, retval]long *plErrInfo);
		[id(17), helpstring("method DisableSending")] HRESULT Disable([in, defaultvalue(-1)]VARIANT_BOOL bDisable);
		[id(18), helpstring("method SendText")] HRESULT SendText([in]BSTR bstrText, [in, optional, defaultvalue(-1)]VARIANT_BOOL bW2A, [in, optional, defaultvalue(0)]long lFlags, [out, retval]long *plSent);
		[id(19), helpstring("method RecvText")] HRESULT RecvText([in]long nLen, [in, optional, defaultvalue(0)]VARIANT_BOOL bWChar, [in, optional, defaultvalue(0)]long lFlags, [out, retval]BSTR *pbstrText);
		[id(20), helpstring("method GetHostByName")] HRESULT GetHostByName([in]BSTR bstrHost, [in, optional, defaultvalue(0)]VARIANT_BOOL bBlocking, [out, optional, defaultvalue(0)]long *phHandle, [out, optional, defaultvalue(0)]BSTR *pbstrIPAddr, [out, optional, defaultvalue(0)]BSTR *pbstrAlias, [out,retval]BSTR *pbstrHostName);
		[propget, id(21), helpstring("property LocalName")] HRESULT LocalName([out, retval] BSTR *pbstrLocalName);
		[propget, id(22), helpstring("property SocketHandle")] HRESULT SocketHandle([out, retval]long *plSocketHandle);	
		[propget, id(23), helpstring("property SendTimeout")] HRESULT SendTimeout([out, retval] long *plSendTimeout);
		[propput, id(23), helpstring("property SendTimeout")] HRESULT SendTimeout([in] long lSendTimeout);
		[propget, id(24), helpstring("property Instance")] HRESULT Instance([out, retval] long *plInstance);
		[propget, id(25), helpstring("property IsConnected")] HRESULT IsConnected([out, retval] VARIANT_BOOL *pbVal);
		[propget, id(26), helpstring("property Events")] HRESULT Events([out, retval] long *plEvents);
		[propget, id(27), helpstring("property UID")] HRESULT UID([out, retval] BSTR *pVal);
		[propput, id(27), helpstring("property UID")] HRESULT UID([in] BSTR newVal);
		[propget, id(28), helpstring("property Password")] HRESULT Password([out, retval] BSTR *pVal);
		[propput, id(28), helpstring("property Password")] HRESULT Password([in] BSTR newVal);
		[propget, id(29), helpstring("property RcvTimeout")] HRESULT RcvTimeout([out, retval] long *plRcvTimeout);
		[propput, id(29), helpstring("property RcvTimeout")] HRESULT RcvTimeout([in] long lRcvTimeout);
		[propget, id(30), helpstring("property ConnectTimeout")] HRESULT ConnectTimeout([out, retval] long *pConnectTimeout);
		[propput, id(30), helpstring("property ConnectTimeout")] HRESULT ConnectTimeout([in] long lConnectTimeout);
		[propget, id(31), helpstring("property WinHandle")] HRESULT WinHandle([out, retval] long *plWinHandle);
		[propput, id(31), helpstring("property WinHandle")] HRESULT WinHandle([in] long lWinHandle);	
	};
	
[
	uuid(696A50FD-B10B-11D5-8A80-002078B038BB),
	version(1.0),
	helpstring("ClientSocket 1.0 Type Library")
]
library CLIENTSOCKETLib
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");

	typedef enum tagClientSocketDefines
	{
		g_nSocketSvrSecurityCheckFailed=0x89000000,
		g_nClientSock_Warning=0x08000000,
		g_nMaxUIDLen=128,
		g_nMaxPasswordLen=128,
		g_nSockErrOffset = 0x80000000,
		g_nSockErrOffsetSvr = 0x88000000,
		g_nCREATE_START_SOCK_CLIENT=0xA00000AA,
	}ClientSocketDefines;
	
	typedef enum tagSockClientMsg
	{
		g_nSocketClientMsg = 0x0781
	}SockClientMsg;
	
	typedef enum tagSockLevel
	{
		g_nSockLevel=0xffff,
	}SockLevel;

	typedef enum tagSocketType{
		SockStream		= 1,		/* stream socket */
		SockDgram		= 2,		/* datagram socket */
		SockRaw			= 3,		/* raw-protocol interface */
		SockRdm			= 4,        /* reliably-delivered message */
		SockSeqpacket	= 5,		/* sequenced packet stream */
	} SocketType;
	
	//client side
	typedef enum tagSocketEvent
	{
		FdREAD     =    1,
		FdWRITE	   =    2,
		FdCONNECT  =	16,
		FdCLOSE    =    32
	}SocketEvent;

	typedef enum tagAddressFormat{
		PfUNSPEC	= 0,
		PfUNIX      = 1,
		PfINET		= 2,
		PfIMPLINK	= 3,
		PfPUP		= 4,
		PfCHAOS		= 5,
		PfIPX		= 6,
		PfNS		= PfIPX,
		PfISO		= 7,
		PfOSI		= PfISO,
		PfECMA		= 8,
		PfDATAKIT	= 9,
		PfCCITT		= 10,
		PfSNA		= 11,
		PfDECnet	= 12,
		PfDLI		= 13,
		PfLAT		= 14,
		PfHYLINK	= 15,
		PfAPPLETALK	= 16,
		PfNETBIOS	= 17,
		PfVOICEVIEW	= 18,
		PfFIREFOX	= 19,
		PfUNKNOWN1	= 20,
		PfBAN		= 21,
		PfMAX		= 22
	}AddressFormat;

	[
		uuid(726360BE-AE26-11D5-8A74-002078B038BB),
		helpstring("_ISktClientEvents Interface")
	]
	dispinterface _ISktClientEvents
	{
		properties:
		methods:
		[id(1), helpstring("method OnDataAvailable")] HRESULT OnDataAvailable([in]long hSocket, [in]long lBytes, [in] long lInfo);
		[id(2), helpstring("method OnOtherMessages")] HRESULT OnOtherMessages([in]long nMsg, [in]long wParam, [in]long lParam);
		[id(3), helpstring("method OnSocketClosed")] HRESULT OnSocketClosed([in]long hSocket, [in]long lError);
		[id(4), helpstring("method OnSocketConnected")] HRESULT OnSocketConnected([in]long hSocket, [in]long lError);
		[id(5), helpstring("method OnConnecting")] HRESULT OnConnecting([in]long hSocket, [in]long hWnd);
		[id(6), helpstring("method OnSendingData")] HRESULT OnSendingData([in]long hSocket, [in]long lError);
		[id(7), helpstring("method OnGetHostByAddr")] HRESULT OnGetHostByAddr([in]long hHandle, [in]BSTR bstrHostName, [in]BSTR bstrHostAlias, [in]long lError);
		[id(8), helpstring("method OnGetHostByName")] HRESULT OnGetHostByName([in]long hHandle, [in]BSTR bstrHostName, [in]BSTR bstrAlias, [in]BSTR bstrIPAddr, [in]long lError);
	};

	[
		uuid(696A510C-B10B-11D5-8A80-002078B038BB),
		helpstring("SktClient Class")
	]
	coclass SktClient
	{
		[default] interface ISktClient;
		[default, source] dispinterface _ISktClientEvents;
	};
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Yuancai (Charlie) Ye
Web Developer
United States United States
Yuancai (Charlie) Ye, an experienced software engineer, lives in Atlanta, Georgia. He is an expert at OLEDB consumer and created a powerful data accessing libarary at the site http://www.udaparts.com. He has been working at SocketPro written from batching, asynchrony and parallel computation for more than three years. Visual C++, C# and ASP.NET are his favorite development environments.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150520.1 | Last Updated 24 Feb 2002
Article Copyright 2002 by Yuancai (Charlie) Ye
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid