Click here to Skip to main content
15,885,896 members
Articles / High Performance Computing / Parallel Processing

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

Rate me:
Please Sign up or sign in to vote.
4.48/5 (19 votes)
23 Feb 200211 min read 179.4K   6.3K   59  
A set of socket libraries for writing distributed computing applications over the internet
// SockFile.idl : IDL source for SockFile.dll
//

// This file will be processed by the MIDL tool to
// produce the type library (SockFile.tlb) and marshalling code.

import "oaidl.idl";
import "ocidl.idl";

	[
		object,
		uuid(41039CFD-ADBC-11D5-8A73-002078B038BB),
		dual,
		helpstring("ISocketFile Interface"),
		pointer_default(unique)
	]
	interface ISocketFile : IDispatch
	{
		[id(131), helpstring("method CloseFile")] HRESULT CloseFile();
		[id(132), helpstring("method FindClose")] HRESULT FindClose();
		[id(133), helpstring("method GetFileAttributes")] HRESULT GetFileAttributes([out, retval] long *plFileAttributes);
		[id(134), helpstring("method SetFileAttributes")] HRESULT SetFileAttributes([in] BSTR bstrFileName, [in]long lFileAttributes);
		[id(135), helpstring("method GetFileSize")] HRESULT GetFileSize([out, optional, defaultvalue(0)] long *plFileSizeHigh, [out, retval] long *plFileSizeLow);
		[id(136), helpstring("method DeleteFile")] HRESULT DeleteFile([in]BSTR bstrFileName);
		[id(137), helpstring("method CreateDirectory")] HRESULT CreateDirectory([in]BSTR bstrDirectory);
		[id(138), helpstring("method RemoveDirectory")] HRESULT RemoveDirectory([in]BSTR bstrDirectory);
		[id(139), helpstring("method GetCurrentDirectory")] HRESULT GetCurrentDirectory();
		[id(140), helpstring("method FindFile")] HRESULT FindFile([in]BSTR bstrFileName);
		[id(141), helpstring("method FindFirstFile")] HRESULT FindFirstFile([in]BSTR bstrFileName);
		[id(142), helpstring("method FindNextFile")] HRESULT FindNextFile();
		[id(143), helpstring("method CreateFile")] HRESULT CreateFile([in]BSTR bstrFileName, [in]long lDesiredAccess, [in]long lShareMode, [in]long lCreationDisposition, [in]long lFlagsAndAttributes);
		[id(144), helpstring("method WriteChunk")] HRESULT WriteChunk([in] VARIANT vtData);
		[id(145), helpstring("method ReadChunk")] HRESULT ReadChunk([in]long lLen);
		[id(146), helpstring("method MoveFile")] HRESULT MoveFile([in]BSTR bstrExistingFileName, [in]BSTR bstrNewFileName);
		[id(147), helpstring("method CopyFile")] HRESULT CopyFile([in]BSTR bstrExistingFileName, [in]BSTR bstrNewFileName, [in, optional, defaultvalue(-1)]VARIANT_BOOL bFailIfExists);
		[id(148), helpstring("method GetFile")] HRESULT GetFile([in]BSTR bstrSrcFileName, [in]BSTR bstrDesFileName, [in, optional, defaultvalue(-1)]VARIANT_BOOL bFailIfExists);
		[id(149), helpstring("method SendFile")] HRESULT SendFile([in]BSTR bstrSrcFileName, [in]BSTR bstrDesFileName, [in, optional, defaultvalue(-1)]VARIANT_BOOL bFailIfExists);
		[id(150), helpstring("method GetCreationTime")] HRESULT GetCreationTime([out]short *pnYear, [out]short *pnMonth, [out]short *pnDayOfWeek, [out]short *pnDay, [out]short *pnHour, [out]short *pnMinute, [out]short *pnSecond, [out]short *pnMilliseconds);
		[id(151), helpstring("method GetLastAccessTime")] HRESULT GetLastAccessTime([out]short *pnYear, [out]short *pnMonth, [out]short *pnDayOfWeek, [out]short *pnDay, [out]short *pnHour, [out]short *pnMinute, [out]short *pnSecond, [out]short *pnMilliseconds);
		[id(152), helpstring("method GetLastWriteTime")] HRESULT GetLastWriteTime([out]short *pnYear, [out]short *pnMonth, [out]short *pnDayOfWeek, [out]short *pnDay, [out]short *pnHour, [out]short *pnMinute, [out]short *pnSecond, [out]short *pnMilliseconds);
		[id(153), helpstring("method SetFilePointer")] HRESULT SetFilePointer([in]long lDistanceToMove, [in]long lMoveMethod);
		[id(154), helpstring("method GetData")] HRESULT GetData([in, optional, defaultvalue(0)]VARIANT_BOOL bA2W, [out, retval]VARIANT *pvtData);
		[id(155), helpstring("method GetRtn")] HRESULT GetRtn([out, retval]long *plResult);
		[id(156), helpstring("method GetFileNameOrDirectory")] HRESULT GetFileNameOrDirectory([out, retval]BSTR *pbstrFileNameOrDirectory);
		[id(157), helpstring("method SetCurrentDirectory")] HRESULT SetCurrentDirectory([in]BSTR bstrCurrentDirectory);
		[id(158), helpstring("method FlushFileBuffers")] HRESULT FlushFileBuffers();
		[id(159), helpstring("method GetSpaceData")] HRESULT GetSpaceData([out]long *plFreeBytesAvailableToCallerLowPart, [out, optional, defaultvalue(0)]long *plTotalNumberOfBytesLowPart, [out, optional, defaultvalue(0)]long *plTotalNumberOfFreeBytesLowPart, [out, optional, defaultvalue(0)]long *plFreeBytesAvailableToCallerHighPart, [out, optional, defaultvalue(0)]long *plTotalNumberOfBytesHighPart, [out, optional, defaultvalue(0)]long *plTotalNumberOfFreeBytesHighPart);
		[id(160), helpstring("method AttachSocket")] HRESULT AttachSocket([in]IUnknown *pIUnknownToSocket);
		[id(161), helpstring("method GetDiskFreeSpaceEx")] HRESULT GetDiskFreeSpaceEx([in]BSTR bstrDirectoryName);
		[id(162), helpstring("method WriteText")] HRESULT WriteText([in]BSTR bstrText, [in, optional, defaultvalue(-1)]VARIANT_BOOL bW2A);
		[propput, id(163), helpstring("property FileKey")] HRESULT FileKey([in] BSTR newVal);
	};

[
	uuid(41039CF1-ADBC-11D5-8A73-002078B038BB),
	version(1.0),
	helpstring("SockFile 1.0 Type Library")
]
library SOCKFILELib
{
	importlib("stdole32.tlb");
	importlib("stdole2.tlb");

	typedef enum tagSockFileDefines
	{
		g_nCREATE_FILE_SOCK_CLIENT=0xA00000FE,
		g_nFILE_SECURITY_CHECK_FALIED=0x89000000,
	}SockFileDefines;

	typedef enum tagThreadEvent
	{
		ThreadStarted=0x782,
		ThreadProcessing=0x783,
		ThreadEnded=0x784,
	}ThreadEvent;

	typedef enum tagFileMethodID
	{
		idCreateFile =			1,
		idReadFile=				2,
		idWriteFile	=			3,
		idDeleteFile =			4,
		idCopyFile	=			5,
		idMoveFile	=			6,
		idFindFile	=			7,
		idFindFirstFile =		8,
		idFindNextFile =		9,
		idCreateDirectory=		10,
		idGetCurrentDirectory=	11,
		idSetFileAttributes=	12,
		idRemoveDirectory=		13,
		idFindClose=			14,
		idFlushFileBuffers=		15,
		idGetFile=				16,
		idSendFile=				17,
		idSetCurrentDirectory=	18,
		idCloseFile	=			19,
		idSetFilePointer=		20,
		idGetDiskFreeSpaceEx=	21
	}FileMethodID;

	[
		uuid(728360BE-AE26-11D5-8C74-002078B038AB),
		helpstring("_ISktClientEvents Interface")
	]
	dispinterface _ISocketFileEvents
	{
		properties:
		methods:
		[id(1), helpstring("method OnThreadStarted")] HRESULT OnThreadStarted([in]long lDirection, [in]long lInfo);
		[id(2), helpstring("method OnThreadProcessing")] HRESULT OnThreadProcessing([in]long lDirection, [in]long lInfo);
		[id(3), helpstring("method OnThreadDead")] HRESULT OnThreadDead([in]long lDirection, [in]long lInfo);
	};

	[
		uuid(41039CFE-ADBC-11D5-8A73-002078B038BB),
		helpstring("SocketFile Class")
	]
	coclass SocketFile
	{
		[default] interface ISocketFile;
		[default, source] dispinterface _ISocketFileEvents;
	};
};

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


Written By
Software Developer (Senior)
United States United States
Yuancai (Charlie) Ye, an experienced C/C++ software engineer, lives in Atlanta, Georgia. He is an expert at continuous inline request/result batching, real-time stream processing, asynchronous data transferring and parallel computation for the best communication throughput and latency. He has been working at SocketPro (https://github.com/udaparts/socketpro) for more than fifteen years.

Comments and Discussions