Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1512

VB6 NewSocket

$
0
0
The original CSocket/SocketMaster emulated the Microsoft Winsock Control. cSocket2 introduced the newer Dual Stack calls that would support IPv6 as well as IPv4 , but remained procedurally the same. All of them supported the sending/receiving of all types of data (byte, string, integer, long, etc). WSA sockets treated everything as byte data and could care less what type of data it was, and it was up to the higher level programs as to how that data was treated. What I found was that all my programs utilizing cSocket2 used string data, which made a lot of the code used to support data types unused and redundant. Even though the conversion of Unicode string data (16 bit) to byte data (8 bit) was inefficient, VB6 contained a plethora of commands that made manipulating string data relatively easy, and inherently took care of garbage collection.

NewSocket sends and receives string data only. There is only a single conversion made to and from byte data.

I was not happy with the way cSocket2 handled errors, so now all errors are returned to the calling program for handling through the Error Event.

Modern Cryptographic techniques are built on top of TCP/IP, so a new Event called "EncrDataArrival" was added along with a flag to allow incoming encrypted data to be treated differently from plain data.

Originally, the LocalPort(PropertyGet) routine would simply return the value of m_lngLocalPort, which was assigned during the Bind process. However, GetAddrInfo automatically assigns the first available socket on a Connect call (Bind not called), and the routine would return zero. It was changed to use GetLocalPort.

J.A. Coutts
Attached Files

Viewing all articles
Browse latest Browse all 1512

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>