CSE691/891 - Internet Programming Summer 2001
prev next

Winsock Control

The socket control is an ActiveX wrapper around the Winsock API that provides a simple interface, accessible from both Visual Basic and C++ programs.

Winsock Control Methods, Properties, and Events

Winsock Control Methods
-- Method --------------------------- Behavior ----------
Bind([LocalPort],[LocalIP]) bind control to a specific IP address and port
Listen() request socket server listen for connection requests
Accept(requestID as Long) accept an incoming connection
Close() close a TCP connection
Connect([RemoteHost],[RemotePort]) request a connection
GetData(data,[type],[maxlen]) retrieve a block of data from the socket buffer
SendData(data) send a block of bytes to a connected socket (TCP)
PeekData(data,[type],[maxlen]) look at data in receive buffer without extracting

Winsock Control Properties
-- Property ---------------------------- Description ----------
BytesReceived number of bytes in the Receive Buffer
LocalHostName local machine name
LocalIP IP address of local machine
LocalPort port to use while sending or receiving
Protocol transmission protocol (TCP or UDP)
RemoteHostIP IP address of remote machine
SocketHandle current socket handle, used with API functions
State current state of control

Winsock Control Events
-- Event ------------------------------- Description ----------
ConnectionRequest client requests connection with server
Connect connection is established
Close connection is closed
DataArrival data received
SendProgress data is being sent
SendComplete data transmission completed
Error transmission error occurred


prev next