Embedded Visual Basic Windows Ce And Pocket Pc Mobile Applications [Electronic resources]

Chris Tacke; Timothy Bassett

نسخه متنی -صفحه : 108/ 80
نمايش فراداده

Team-Fly
eMbedded Visual Basic®: Windows® CE and Pocket PC Mobile Applications

By Chris Tacke, Timothy Bassett

Table of Contents
appendix A. Control Reference

The CE WinSock Object Model

The following tables outline the Object Model for the CE WinSock Control. This control is included in MSCEWinsock.dll.

Table A.40. WinSock Methods

Method

Return

Description

Accept Nothing Used to accept a connection after a ConnectionRequest event fires.
Close Nothing Closes a transmitting or listening socket.
Connect Nothing Requests a connection with the host named in the RemoteHost property of the control through the port named in the RemotePort property.
GetData Nothing Retrieves the current block of data from a WinSock control's buffer. Only Strings and Integer arrays are supported.

Note: The maxLen parameter is not implemented and any value provided is ignored.

Listen Nothing Puts a WinSock control into listen mode for the protocol specified in the Protocol property.
SendData Nothing Sends data through the current WinSock to the remote host. Only Strings and Integer arrays are supported.

Table A.41. WinSock Properties

Property

Return

Description

BytesReceived Integer

Read-Only. Gets the amount of data, in bytes, received by the WinSock control.

LocalHostName String

Read-Only. Gets the name of the local machine (device name).

LocalIP String

Read-Only. Gets the local IP address in dotted-string format (xxx.xxx.xxx.xxx).

LocalPort Integer Sets or Gets the local port for use by the WinSock control.
Name String Gets the logical name of the WinSock control as set in the Properties window.
Parent Object Returns a reference to the WinSock control's parent object, such as its containing form.
Protocol SockCtrlProtocol Sets or gets the protocol used for transfer by the WinSock control. Only TCP/IP and IrDA are supported.
RemoteHost String Sets or Gets the IP or host name of the remote machine the socket is connected or will connect to.
RemoteHostIP String

Read-Only. Gets the IP address or the remote host in dotted-string format (xxx.xxx.xxx.xxx) after a successful connection.

RemotePort Integer Sets or Gets the remote host port the WinSock control is connected or will connect to.
SocketHandle Long

Read-Only. Gets the window handle for the currently open socket used by the WinSock control. This is useful for making calls to the WinSock API.

State SockCtrlState

Read-Only. Gets the current state of the WinSock control.

ServiceName String Sets or Gets the service name for an IrDA socket connection.
Tag String Sets or Gets a string that can be used to hold any additional information the programmer wants to store.

Table A.42. WinSock Control Events

Event

Description

Close Fires when the remote host closes the socket connection.
ConnectionRequest Fires when a request is received on a Listening socket.
Connect Fires when the Connect method succeeds.
DataArrival Fires when the socket's buffer receives new data into an empty buffer.
Error Fires when an error occurs while processing for a socket.
SendComplete Fires when the SendData method has completed sending all of its data.
SendProgress Fires after each packet of data has been sent. Data larger than 8k is automatically packetized by the control.

Table A.43. SockCtrlError Constants

Constant

Value

Description

SckOutOfMemory 7 The system is out of memory.
SckInvalidPropertyValue 380 The property value is invalid.
SckGetNotSupported 394 The property cannot be read.
SckSetNotSupported 383 The property is read-only.
SckBadState 40006 Wrong protocol or connection state for the requested transaction or request.
SckInvalidArg 40014 The parameter passed to a function is not in the correct format or in the specified range.
SckSuccess 40017 Successful.
SckUnsupported 40018 Unsupported variant type.
SckInvalidOp 40020 Invalid operation at current state.
SckOutOfRange 40021 Parameter is out of range.
SckWrongProtocol 40026 Wrong protocol for the requested transaction or request.
SckOpCanceled 10004 The operation is canceled.
SckInvalidArgument 10014 The requested address is a broadcast address, but flag is not set.
SckWouldBlock 10035 Socket is nonblocking and the specified operation will block.
SckInProgress 10036 A blocking WinSock operation is in progress.
SckAlreadyComplete 10037 The operation is completed. No blocking operation in progress.
SckNotSocket 10038 The descriptor is not a socket.
SckMsgTooBig 10040 The datagram is too large to fit into the buffer and therefore is truncated.
SckPortNotSupported 10043 The specified port is not supported.
SckAddressInUse 10048 Address in use.
SckAddressNotAvailable 10049 Address unavailable from the local computer.
SckNetworkSubsystemFailed 10050 Network subsystem failed.
SckNetworkUnreachable 10051 The network cannot be reached from this host at this time.
SckNetReset 10052 Connection has timed out.
SckConnectAborted 10053 Connection aborts due to timeout or other failure.
SckConnectionReset 10054 The connection is reset by the remote device.
SckNoBufferSpace 10055 Buffer space is unavailable.
SckAlreadyConnected 10056 Socket is already connected.
SckNotConnected 10057 Socket is not connected.
SckSocketShutdown 10058 Socket has been shut down.
SckTimedout 10060 Socket did not connect with timeout period
SckConnectionRefused 10061 Connection is forcefully rejected.
SckNotInitialized 10093 WinSockInit should be called first.
SckHostNotFound 11001 Authoritative answer: Host not found.
SckHostNotFoundTryAgain 11002 Non-Authoritative answer: Host not found.
SckNonRecoverableError 11003 Non-recoverable errors.
SckNoData 11004 Valid name; no data record of requested type.

Table A.44. SockCtrlProtocol Constants

Constant

Value

Description

SckIRDAProtocol 2 Socket will use the TCP/IP protocol.
SckTCPProtocol 0 Socket will use the device's infrared port.

Table A.45. SockCtrlState Constants

Constant

Value

Description

SckClosed 0 Closed (default)
SckOpen 1 Open
SckListening 2 Listening
SckConnectionPending 3 Connection Pending
SckResolvingHost 4 Resolving host
SckHostResolved 5 Host resolved
SckConnecting 6 Connecting
SckConnected 7 Connected
SckClosing 8 Peer is closing the connection
SckError 9 Error


    Team-Fly