[fpc-pascal]ssockets
md
md at realmwireless.com
Sat Nov 4 20:15:17 CET 2000
You will need to interface directly to Win32 - May I suggest looking at
Winsock 2.
The attached file is some of the WIN32 interface to Winsock 2. The
standard winsock.pas stuff will handle the rest.
Mark
Atlanta, GA
Mirek a Marcela wrote:
>
> Hello,
>
> I've not found st similar to ssockets.pp for Win32. Does it exist?
>
> Mirek Novak
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
-------------- next part --------------
unit sockbt20;
//Copyright Mark Diener 1996 All rights reserved
interface
uses windows,winsock ;
const
MSG_INTERRUPT = $10 ;
MSG_MAXIOVLEN = 16 ;
MAXGETHOSTSTRUCT = 1024 ;
FD_READ_BIT = 0 ;
FD2_READ = 1 shl FD_READ_BIT ;
FD_WRITE_BIT = 1 ;
FD2_WRITE = 1 shl FD_WRITE_BIT ;
FD_OOB_BIT = 2 ;
FD2_OOB = 1 shl FD_OOB_BIT ;
FD_ACCEPT_BIT = 3 ;
FD2_ACCEPT = 1 shl FD_ACCEPT_BIT ;
FD_CONNECT_BIT = 4 ;
FD2_CONNECT = 1 shl FD_CONNECT_BIT ;
FD_CLOSE_BIT = 5 ;
FD2_CLOSE = 1 shl FD_CLOSE_BIT ;
FD_QOS_BIT = 6 ;
FD2_QOS = 1 shl FD_QOS_BIT ;
FD_GROUP_QOS_BIT = 7 ;
FD2_GROUP_QOS = 1 shl FD_GROUP_QOS_BIT ;
FD_MAX_EVENTS = 8 ;
FD2_ALL_EVENTS = (1 shl FD_MAX_EVENTS)-1 ;
//typedef struct _OVERLAPPED * LPWSAOVERLAPPED;
WSA_IO_PENDING = (ERROR_IO_PENDING) ;
WSA_IO_INCOMPLETE = (ERROR_IO_INCOMPLETE) ;
WSA_INVALID_HANDLE = (ERROR_INVALID_HANDLE) ;
WSA_INVALID_PARAMETER = (ERROR_INVALID_PARAMETER);
WSA_NOT_ENOUGH_MEMORY = (ERROR_NOT_ENOUGH_MEMORY);
WSA_OPERATION_ABORTED = (ERROR_OPERATION_ABORTED);
WSA_MAXIMUM_WAIT_EVENTS = (MAXIMUM_WAIT_OBJECTS) ;
WSA_WAIT_FAILED = -1 ;
WSA_WAIT_EVENT_0 = (WAIT_OBJECT_0) ;
WSA_WAIT_IO_COMPLETION = (WAIT_IO_COMPLETION) ;
WSA_WAIT_TIMEOUT = (WAIT_TIMEOUT) ;
WSA_INFINITE = (INFINITE) ;
CF_ACCEPT = $0000 ;
CF_REJECT = $0001 ;
CF_DEFER = $0002 ;
SD_RECEIVE = $00 ;
SD_SEND = $01 ;
SD_BOTH = $02 ;
SG_UNCONSTRAINED_GROUP = $01 ;
SG_CONSTRAINED_GROUP = $02 ;
type
TSOCKETGROUP = integer ;
TWSABUF = packed record
len : LongInt ;
buf : Pchar ;
end;
Tguarantee =(
etBestEffortService,
etControlledLoadService,
etPredictiveService,
etGuaranteedDelayService,
etGuaranteedService) ;
PFlowspec = ^TFlowspec ;
TFlowspec = packed record
TokenRate :integer ; //* In Bytes/sec */
TokenBucketSize :integer; //* In Bytes */
PeakBandwidth :integer; //* In Bytes/sec */
Latency :integer; //* In microseconds */
DelayVariation :integer; //* In microseconds */
Guaranteelevel : Integer ;
CostOfCall : Integer; //* Reserved for future use, */
NetworkAvailability : Integer; //* read-only: */
end;
TQualityOfService = packed record
SendingFlowspec : TFlowSpec;
ReceivingFlowspec : TFlowSpec;
ProviderSpecific : TWSABuf ; //* additional provider specific stuff */
end;
// WSAAPI = FAR PASCAL
WSAEVENT = integer ;
LPWSAEVENT = ^THANDLE ;
// WSAOVERLAPPED = OVERLAPPED ;
PTWSAEVENTS = ^PTWSAEVENTS ;
TWSAEVENTS = record
whatEvent : longint ;
errcodes : array[0..FD_MAX_EVENTS] of integer;
end;
type
Twsafptrenum = function(sock : Tsocket; netobj : THandle; evts : PTWSAEVENTS):integer ; stdcall ;
Twsafptrevent = function(sock : Tsocket; netobj : THandle; flags :longint) :integer ; stdcall ;
Twsatrysect = function(var lpCriticalSection: TRTLCriticalSection): BOOL; stdcall;
//function WSAEnumNetworkEvents(sock : Tsocket; netobj : THandle; evts : PTWSAEVENTS):integer ; stdcall ;
//function WSAEventSelect(sock : Tsocket; netobj : THandle; flags :longint) :integer ; stdcall ;
implementation
//We will explicitly load these function if we are not running WIN95
//function WSAEnumNetworkEvents; external 'WS2_32.DLL' name 'WSAEnumNetworkEvents';
//function WSAEventSelect; external 'WS2_32.DLL' name 'WSAEventSelect';
initialization
end.
More information about the fpc-pascal
mailing list