Testing of the Winsock (ActiveX) with the SX Ethernet Demo Board and VBScripting
Lesson 3 "Changing the SX's Source code."
Okay, we are now into lesson 3 with some more great fun.
Firts of lets locate that part of the code that we were discussing in lesson 2. I usually find it the quickest by using the find feature and then finding UDPAppProcPktIn in the source code. After you have found this source code lets now make some changes to it. I know this seems a bit old school but we all started out with the "HELLO WORLD" string and that is what we are going to send the browser. What is in the Blue is what has already been done from our friends at Ubicom. What I put in red is what we are going to be adding in or changing.
So lets get started.
; ******************************************************************************
UDPAppProcPktIn
; Application Incoming UDP packet handler (Example)
; This function is called whenever an application (matches udpRxDestPortxSB)
; packet is received. The appplication can call NICReadAgain() to extract
; sequentially extract each byte of the field in the UDP packet.
; [UDP API Function]
; INPUT: {udpRxDataLenMSB,udpRxDataLenLSB} = number of bytes in UDP
; {udpRxSrcPortMSB,udpRxSrcPortLSB} = UDP
; OUTPUT: none
; ******************************************************************************
call NICReadAgain_7
and w, #%01000000
xor ra, w ; toggle I/O pins
_bank UDP_BANK
clr udpTxSrcPortMSB
clr udpTxSrcPortLSB
Now that you have made your changes to your SX's source code when you press the button bellow you should now get "HELLO WORLD" displayed in the last text box.
This is the object tag for MSWINSOCK Ver. 6.0Set up a form here and call it LabelControls, it will have no Action.
Now lets take a closer look at the control.
Sub Sock_DataArrival(ByVal bytesTotal)
Dim New_info
'vbString or vbInteger
Sock.GetData New_info, vbString
'Write info to the READOUT Textbox.
Form1.READOUT.Value = New_info
End Sub
Now you should use vbString for String data and vbInteger for sctrictly integer data.