WSP函数Word文件下载.docx
- 文档编号:3639423
- 上传时间:2023-05-02
- 格式:DOCX
- 页数:151
- 大小:101.68KB
WSP函数Word文件下载.docx
《WSP函数Word文件下载.docx》由会员分享,可在线阅读,更多相关《WSP函数Word文件下载.docx(151页珍藏版)》请在冰点文库上搜索。
WSPEnumNetworkEvents(23)
WSPEventSelect(25)
Headerand.IdlFilesProvidedwithISA(28)
WSPGetOverlappedResult(29)
WSPGetPeerName(31)
WSPGetQOSByName(32)
WSPGetSockName(33)
WSPGetSockOpt(34)
WSPIoctl(37)
WSPJoinLeaf(45)
WSPListen(48)
WSPRecv(50)
WSPRecvDisconnect(54)
WSPRecvFrom(55)
wsprintfFunction(60)
WSProxyAddressProperty(62)
WSProxyPortProperty(63)
WSPSelect(63)
WSPSend(66)
WSPSendDisconnect(69)
WSPSendTo(70)
WSPSetSockOpt(74)
WSPShutdown(77)
WSPSocket(78)
WSPStartup(80)
WSPStringToAddress(84)
WSPAccept
TheWSPAcceptfunctionconditionallyacceptsaconnectionbasedonthereturnvalueofaconditionfunction.
SOCKETWSPAccept(SOCKETs,structsockaddr*addr,LPINTaddrlen,LPCONDITIONPROClpfnCondition,DWORDdwCallbackData,LPINTlpErrno);
Parameters
s[in]DescriptoridentifyingasocketthatislisteningforconnectionsafteraWSPListen.
addr[out]Optionalpointertoabufferthatreceivestheaddressoftheconnectingentity,asknowntotheserviceprovider.TheexactformatoftheaddrparameterisdeterminedbytheaddressfamilyestablishedwhenthesocketintheSOCKADDRstructurewascreated.
addrlen[in,out]Optionalpointertoanintegerthatcontainsthelengthoftheaddrparameter,inbytes.
lpfnCondition[in]Procedureinstanceaddressofanoptional-conditionfunctionfurnishedbyWindowsSockets.Thisfunctionisusedintheacceptorrejectdecisionbasedonthecallerinformationpassedinasparameters.
dwCallbackData[in]CallbackdatatobepassedbacktotheWindowsSocket2clientasthevalueofthedwCallbackDataparameteroftheconditionfunction.Thisparameterisnotinterpretedbytheserviceprovider.
lpErrno[out]Pointertotheerrorcode.
ReturnValuesIfnoerroroccurs,WSPAcceptreturnsavalueoftypeSOCKETthatisadescriptorfortheacceptedsocket.Otherwise,avalueofINVALID_SOCKETisreturned,andaspecificerrorcodeisavailableinlpErrno.
Errorcode
Meaning
WSAECONNREFUSED
Theconnectionrequestwasforcefullyrejectedasindicatedinthereturnvalueoftheconditionfunction(CF_REJECT).
WSAENETDOWN
Thenetworksubsystemhasfailed.
WSAEFAULT
TheaddrlenparameteristoosmallorthelpfnConditionparameterisnotpartoftheuseraddressspace.
WSAEINTR
A(blocking)callwascanceledthroughWSPCancelBlockingCall.
WSAEINPROGRESS
AblockingWindowsSocketscallisinprogress.
WSAEINVAL
WSPListenwasnotinvokedpriortoWSPAccept,parametergspecifiedintheconditionfunctionisnotavalidvalue,thereturnvalueoftheconditionfunctionisnotavalidone,oranycasewherethespecifiedsocketisinaninvalidstate.
WSAEMFILE
QueueisnonemptyuponentrytoWSPAcceptandtherearenosocketdescriptorsavailable.
WSAENOBUFS
Nobufferspaceisavailable.
WSAENOTSOCK
Thedescriptorisnotasocket.
WSAEOPNOTSUPP
Referencedsocketisnotatypethatsupportsconnection-orientedservice.
WSATRY_AGAIN
Acceptanceoftheconnectionrequestwasdeferredasindicatedinthereturnvalueoftheconditionfunction(CF_DEFER).
WSAEWOULDBLOCK
Socketismarkedasnonblockingandnoconnectionsarepresenttobeaccepted.
WSAEACCES
Theconnectionrequestthatwasofferedhastimedoutorbeenwithdrawn.
Remarks
TheWSPAcceptfunctionextractsthefirstconnectiononthequeueofpendingconnectionsonsockets,andchecksitagainsttheconditionfunction,providedtheconditionfunctionisspecified(thatis,notnull).Theconditionfunctionmustbeexecutedinthesamethreadasthisroutine.IftheconditionfunctionreturnsCF_ACCEPT,WSPAcceptcreatesanewsocket.
Newlycreatedsocketshavethesamepropertiesasthesockets,includingnetworkeventsregisteredwithWSPAsyncSelectorwithWSPEventSelect.AsdescribedinDescriptorAllocation,whennewsocketdescriptorsareallocated,IFSprovidersmustcallWPUModifyIFSHandleandnon-IFSprovidersmustcallWPUCreateSocketHandle.
IftheconditionfunctionreturnsCF_REJECT,WSPAcceptrejectstheconnectionrequest.Iftheapplication'
saccept/rejectdecisioncannotbemadeimmediately,theconditionfunctionwillreturnCF_DEFERtoindicatethatnodecisionhasbeenmade.Noactionaboutthisconnectionrequestistobetakenbytheserviceprovider.Whentheapplicationisreadytotakeactionontheconnectionrequest,itwillinvokeWSPAcceptagainandreturneitherCF_ACCEPTorCF_REJECTasareturnvaluefromtheconditionfunction.
Forsocketsthatareinthe(default)blockingmode,ifnopendingconnectionsarepresentonthequeue,WSPAcceptblocksthecalleruntilaconnectionispresent.Forsocketsinnonblockingmode,ifthisfunctioniscalledwhennopendingconnectionsarepresentonthequeue,WSPAcceptreturnstheerrorcodeWSAEWOULDBLOCK.Theacceptedsocketcannotbeusedtoacceptmoreconnections.Theoriginalsocketremainsopen.
Theparameteraddrisaresultparameterthatisfilledwiththeaddressoftheconnectingentity,asknowntotheserviceprovider.Theexactformatoftheaddrparameterisdeterminedbytheaddressfamilyinwhichthecommunicationisoccurring.Theaddrlenisavalue-resultparameter;
itwillinitiallycontaintheamountofspacepointedtobyaddr.Onreturn,itmustcontaintheactuallength(inbytes)oftheaddressreturnedbytheserviceprovider.Thiscallisusedwithconnection-orientedsockettypessuchasSOCK_STREAM.Ifaddrand/oraddrlenareequaltonull,thennoinformationabouttheremoteaddressoftheacceptedsocketisreturned.Otherwise,thesetwoparametersshallbefilledinregardlessofwhethertheconditionfunctionisspecifiedorwhatitreturns.
Theprototypeoftheconditionfunctionisasfollows:
intCALLBACKConditionFunc(INLPWSABUFlpCallerId,INLPWSABUFlpCallerData,INOUTLPQOSlpSQOS,INOUTLPQOSlpGQOS,INLPWSABUFlpCalleeId,INLPWSABUFlpCalleeData,OUTGROUPFAR*g,INDWORDdwCallbackData);
ThelpCallerIdandlpCallerDataarevalueparametersthatmustcontaintheaddressoftheconnectingentityandanyuserdatathatwassentalongwiththeconnectionrequest.Ifnocalleridentifierorcallerdataisavailable,thecorrespondingparameterwillbenull.Manynetworkprotocolsdonotsupportconnect-timecallerdata.Mostconventionalnetworkprotocolscanbeexpectedtosupportcalleridentifierinformationatconnection-requesttime.ThebufpartoftheWSABUFpointedtobylpCallerIdpointstoaSOCKADDR.TheSOCKADDRisinterpretedaccordingtoitsaddressfamily(typicallybycastingtheSOCKADDRtosometypespecifictotheaddressfamily).
ThelpSQOSparameterreferencestheflowspecificationsforsocketsspecifiedbythecaller,oneforeachdirection,followedbyanyadditionalprovider-specificparameters.Thesendingorreceivingflowspecificationvalueswillbeignoredasappropriateforanyunidirectionalsockets.AnullvalueforlpSQOSindicatesthatthereisnocaller-suppliedQOSandthatnonegotiationispossible.Anon-NULLlpSQOSpointerindicatesthataQOSnegotiationistooccurorthattheproviderispreparedtoaccepttheQOSrequestwithoutnegotiation.
ThelpCalleeIdisavalueparameterthatcontainsthelocaladdressoftheconnectedentity.ThebufpartoftheWSABUFpointedtobylpCalleeIdpointstoaSOCKADDR.TheSOCKADDRisinterpretedaccordingtoitsaddressfamily(typicallybycastingtheSOCKADDRtosometypespecifictotheaddressfamily).
ThelpCalleeDataisaresultparameterusedbytheconditionfunctiontosupplyuserdatabacktotheconnectingentity.Thestorageforthisdatamustbeprovidedbytheserviceprovider.ThelpCalleeData->
leninitiallycontainsthelengthofthebufferallocatedbytheserviceproviderandpointedtobylpCalleeData->
buf.Avalueofzeromeanspassinguserdatabacktothecallerisnotsupported.TheconditionfunctionwillcopyuptolpCalleeData->
lenbytesofdataintolpCalleeData->
buf,andthenupdatelpCalleeData->
lentoindicatetheactualnumberofbytestransferred.Ifnouserdataistobepassedbacktothecaller,theconditionfunctionwillsetlpCalleeData->
lentozero.Theformatofalladdressanduserdataisspecifictotheaddressfamilytowhichthesocketbelongs.
ThedwCallbackDataparametervaluepassedtotheconditionfunctionisthevaluepassedasthedwCallbackDataparameterintheoriginalWSPAcceptcall.ThisvalueisinterpretedonlybytheWindowsSockets2client.ThisallowsaclienttopasssomecontextinformationfromtheWSPAcceptcallsitethroughtotheconditionfunction,whichprovidestheconditionfunctionwithanyadditionalinformationrequiredtodeterminewhethertoaccepttheconnection.Atypicalusageistopassa(suitablycast)pointertoadatastructurecontainingreferencestoapplication-definedobjectswithwhichthissocketisassociated.
Requirements
Client:
IncludedinWindows
XP,Windows
2000Professional,andWindows
NTWorkstation3.51andlater.
Server:
IncludedinWindowsServer
2003,Windows
2000Server,andWindows
NTServer3.51andlater.
Header:
DeclaredinWs2spi.h.
SeeAlsoWSPAccept,WSPBind,WSPConnect,WSPGetSockOpt,WSPListen,WSPSelect,WSPSocket,WSPAsyncSelect,WSPEventSelect
WSPAddressToString
TheWSPAddressToStringfunctionconvertsallcomponentsofaSOCKADDRstructureintoahumanreadable–numericstringrepresentationoftheaddress.Thisisusedmainlyfordisplaypurposes.
intWSPAddressToString(LPSOCKADDRlpsaAddress,DWORDdwAddressLength,LPWSAPROTOCOL_INFOlpProtocolInfo,LPWSTRlpszAddressString,LPDWORDlpdwAddressStringLength,LPINTlpErrno);
lpsaAddress[in]PointertoaSOCKADDRstructuretotranslate
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- WSP 函数