OpenSock for Asymetrix Toolbook by G.W. van der Vegt

Download and Version History:

Version 1.2c is available, although i still have to finish the documentation and   rework the demos.

I've also provided a mtb40 version of the widget book. I'll be working on an integration of the widget property editor and the online help for that version. I had to leave out the rasdial widget because it's a 32 bits dll i used. I'll look into the 16 bits version when i have some time and find a suitable sample in c or delphi to determine the value some hard to get constants.

I've left out the samples this time because i have to redo them with new scripts (and yes, i know that my spare time is limited too).

Last thing i want to work on is the udg mode winsock applications can use to setup connections. I plan to implement the TFPT protocol (which is a very lightweigth file transfer protocol that looks a bit like good old xmodem).

Currently Opensock can :

  • send e-mail including binary attachments of unlimted size
  • retrieve e-mail (bound to a 64k limit per e-mail due to using toolbook ;-)
  • retrieve (binary) files from http server
  • can, mimic a ftp server including real or simulated filesystem
  • request time from a ntp time server
  • retrieve book properties over the internet
  • delivers a toolbook 1.5 alike command window over the internet
  • implement chat server/client
  • emulate basic internet services like discard, chargen, qotd and echo
  • lookup dynamic ip addresses
  • create a full blow webserver with real or simulated content and support for binary files and authentication
  • transform toolbook drawings on-the-fly into into vrml worlds
  • have a feedback dialog e-mail the feeback directly to you
  • check for updated versions/content of your software of content on the web
    and (off-course) much more (if you're a bit of a creative person).

Good suggestions, discard the idea that content should be on disk or existing at all.With toolbook you got the full programming power of Toolbook to generate whatever contents a client application need to be fooled into thinking what you think it needs to see. Furthermore OpenSock lets you use the internet to your advantage from within toolbook. With Opensock you can e-mail without depending on a particulair brand of web browser being installed, all well contained from within your application.

So USE internet,
don't let internet use you.

If you got any questions or good ideas about opensock, feel free to e-mail me.

version 1.2c (tb-ii/5) or version 1.2c (mtb40)

  • Added final data processing in fdclose handling.
  • Added a http request widget that allows you to fetch a (binary) file from a http server (which is
    handy for neuron in insucure mode).
  • Corrected a winnt releated bug in the data size reported to the fdread callback handler.
  • Added support for a widget that retrieves dynamic ip addresses from the machine it's running on.
  • Ported the widget catalog back to mtb40 (but had to leave out the rasdial widget)

    Please send any comments or requests to my e-mail address.

version 1.2a (preview)

  • Version number changed to 1.2.
  • Added a small services file into findservice, so this function will always work for the most populair services.
  • Added fdwrite to callback functions, to further complement the package. Not very usefull though.
  • Removed bug in OS_startservice_deamon.
  • Most samples ported to Toolbook II widget model (or Extended Objects as they will be called in the upcoming version 6.0)
  • Added 'OS_locatewidget' handler
  • Added 'OS_scanforproperties' handler

version 1.0e (internal)

  • Version number changed to 1.0e
  • Made mode a socket property, so sockets can all operate in their own mode. Incoming connections will inherit the mode of the listening socket.
  • Mode is now optional parameter for OS_startport_daemon and OS_startservice_daemon.
  • Mode still defaults to "line" for OS_startport_client and OS_startservice_client.
  • Removed WO_* property clearing from OS_linkdll, a beta leftover
  • Added OS_setdefaultmode for setting a default mode. If you do nothing, the mode will default to "line"
  • It's now possible to work default in line mode, but listen for raw binary connections too. Needed for ftp and other binary protocols.

version 1.0d (internal)

  • Version number changed to 1.0d
  • Added sntp (simple network time protocol) client, using raw mode
  • Added basic web server client, using line mode
  • Performed performance & stability tests
    CPUInternal memoryLocal browsersRemote browsersRequest sizeSpeedThroughput
    dx2-6620 Mb1 x IE4 20kb0.4 req/sec8kb/sec
    p13380 Mbup to 3 x IE4up to 3 x IE420kb4-5 req/sec80-100kb/sec
    p200pro64 Mbtodotodo20kb??

Current uptime on P133 more > 10 days and > 5.7M hits

  • Fixed memory leak in OS_connecttoport
  • Changed linger options in OS_Winsock/FD_ACCEPT to minimize memory leakage.
  • Added OS_peekbuf to look in buffer before a crlf arrives
  • Implemented a first version of fast decoding. Must still be optimized....
  • Added fdread callback
  • Added OS_setmode handler to set the parsing mode of received data to raw,line or char, raw will call fdread callback, line and char will call line_received callback.
  • OS_setmode can combine raw with line or char.
  • Fixed a problem with line mode & telnet connections
  • Changed SOCKET_ERROR from -1 into 65535 due to sign errors
  • Changed OS_inbuf to re-usable one like in "new.tbk"
  • Linked tbkxxwin.dll according to sysversion (xx=40 or 50)
  • Added conditional init to start_ handlers
  • Added/updated some comments
  • Changed OS_storage_index to a utility handler by passing it the array by reference. Only problem is the initial size of the 2nd dimension.

version 1.0c

  • Version number changed to 1.0c
  • Fixed a small bug in backspace handling.
  • Added first version of start client handlers, simplifying starting clients by hiding more details.
  • Fixed a bug in OS_conecttoport, host address=dword instead of a longint. (thanks to Dan Tasota)
  • Start changing type of socket from INT to WORD.
  • Debugmsg sent by this script now have socket number 0 Fixed some errors/ommisions in the script's comments
  • Made the OS_inbuf dynamic of size, (OS_maxsockets-1) so the dimension is 255 for Win95 and 65535 for WinNT4
  • Clearing & initializing of OS_inbuf moved to OS_startup as that's the place where the max number of sockets is retrieved.
  • Changed type of cmd parameter of ioctlsocket from LONG to DWORD
  • Added resolved ip address&port number of other side to debugging output and OS_peername, a wrapper around the winsock function.
  • Updated documentation in OpenSock.doc Added OS_shutdown handler
  • Changed return type of socket from INT to WORD
  • Added OS_shutdown handler
  • Added resolved ip address&port number of this side to debugging output and OS_socketname, a wrapper around the winsock function GetSocketName. This function is needed for multiple servers inside one book to retrieve the port number of the notification.
  • Added version number to debbugging output
  • Changed PointerInt's to PointerWord due to continuing problems with C's lack of checking range check errors on integers.
  • Changed the inbuffer to a 2 dimensional array due to the the fact that WinNT 4 has a maximum of 65536 sockets.
  • Added an update application to update shared OpenSock scripts in all demos.
  • Added a guestbook sample that stores guest data in itself and also shows how to program more than one webserver in a single toolbook object.

version 1.0b

Added first version of start server handlers, simplifying starting servers by hiding more details. Never released.

version 1.0a

Initial release to and the TB II developers corner news at