home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / ipx_spx / ipxspx.txt < prev    next >
Text File  |  1994-05-20  |  10KB  |  348 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. IPX & SPX Custom Controls v2.00
  8. For
  9. Visual BasicTM 3.0
  10. &
  11. WindowsTM 3.1
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. Introduction
  39.  
  40. IPX (Internetwork Packet Exchange) protocol is a datagram (connectionless) service used 
  41. as the underlying protocol in Novell NetWare.  IPX establishes no connections nor 
  42. guarantee of delivery.  Each packet a workstation sends is treated separately.  SPX 
  43. (Sequenced Packet Exchange) is a connection-oriented protocol providing guaranteed 
  44. packet delivery, flow control, and sequencing.  SPX has many of the characteristics of the 
  45. transport level of OSI.  IPX/SPX are adaptations of protocols developed by Xerox(r), the 
  46. Xerox Network System, XNS(tm).
  47.  
  48. NetWare addressing is similar to the postal service's addressing system that identifies 
  49. recipients by country, state, city, street, number, apartment, and individual names.  
  50. NetWare addresses consist of three components:  network number, node address, and 
  51. socket.  Network numbers identify each segment of an internetwork.  Network numbers 
  52. are assigned when NetWare file servers and bridges are installed.  IPX derives the node 
  53. address from the address of each network adapter card.  Socket numbers provide routing 
  54. within a node, since several processes can be running simultaneously.  Processes can open 
  55. and close sockets to receive and send packets.
  56.  
  57. The IPX and SPX custom controls allow you to communicate with remote machines 
  58. connected by a local area network.  To use the control, you must have the workstations 
  59. set up as NetWare clients.  This involves loading IPX.COM or IPXODI.COM before 
  60. Windows loads.  The examples provided also require installing NETX or VLMs because 
  61. they use several NetWare services to find other users.
  62.  
  63. The IPX and SPX custom controls are event driven and relieve the application from 
  64. polling the status of network communication channels.  When new data is received from a 
  65. remote machine, the IPX or SPX custom control fires a Visual Basic subroutine allowing 
  66. the application to service the received information.
  67.  
  68. Several examples are provided showing how to use the controls.  Further information 
  69. about IPX and SPX can be found in the following references:  Client SDK Documentation 
  70. and C Programmer's Guide by Novell, C Programmer's Guide To NetBIOS, IPX And 
  71. SPX by W. David Schwaderer, Programmer's Guide to NetWare by Charles Rose, and 
  72. Network Programming in C, by Barry Nance.
  73.  
  74. Control Properties
  75.  
  76. (These properties apply to both controls, unless indicated otherwise)
  77.  
  78. Socket
  79. [form.]Control.Socket[ = numericexpression]
  80.  
  81. Sets the socket that the control listens to and sends packets out through.
  82.  
  83. Example:  spx1.Socket = &H5454
  84.  
  85. ReceiveECBS
  86. [form.]Control.ReceiveECBS[ = numericexpression]
  87.  
  88. Settings
  89. Default = 5 
  90.  
  91. Sets the number of ECBs that are used to receive packets.  Currently, this property should 
  92. only be set in the design environment and not at run time.   
  93.  
  94. SendECBS
  95. [form.]Control.SendECBS[ = numericexpression]
  96.  
  97. Settings
  98. Default = 1
  99.  
  100. Sets the number of ECBs that are used to send packets.  Currently, this property should 
  101. only be set in the design environment and not at run time.  In addition, this property 
  102. should currently be set to 1.
  103.  
  104. Channels
  105. [form]Control.Channels[ = numericexpression]
  106. (not applicable for IPX)
  107.  
  108. Settings
  109. Default = 1
  110.  
  111. Sets the maximum number of connections that the control will need to service. This 
  112. property can be set once after the control is loaded and cannot change until the control is 
  113. reloaded.  Currently, this property has no effect.
  114.  
  115. Example:  spx1.Channels = 1
  116.  
  117. Connection
  118. [form]Control.Connection
  119. (not applicable for IPX)
  120.  
  121. Returns the SPX connection ID assigned to this connection by SPX.  This ID may be used 
  122. to make SPX calls in NWIPXSPX.DLL.
  123.  
  124. Example:  id% = spx1.Connection
  125.  
  126. Send
  127. [form.]Control.Send[ = stringexpression]
  128.  
  129. Sends stringexpression to a remote node specified by RemoteName.
  130.  
  131. Example:  spx1.Send="HELLO WORLD"
  132.  
  133. Received
  134. [form.]Control.Received
  135.  
  136. Return Data Type     String
  137.  
  138. Retrieves data retrieved from the network.  When data is received, the control will call the 
  139. Visual Basic subroutine spx1_ReceiveData 
  140.  
  141. Example: 
  142. Sub spx1_ReceiveData ()
  143.     Data$ = spx1.Received
  144. End Sub
  145.  
  146. ReceivedFrom
  147. [form.]Control.ReceivedFrom 
  148.  
  149. Return Data Type    String * 12
  150.  
  151. Returns the internet address (network, node, and socket) of the node that sent the most 
  152. recently received packet.  
  153.  
  154. Example:  
  155. Sub spx1_ReceiveData()
  156.     From$ = spx1.ReceivedFrom
  157.             Data$ = spx1.Received 
  158.  End Sub
  159.  
  160. Event
  161. [form.]Control.Event
  162.  
  163. Return Data Type    Integer
  164.  
  165. Retrieves an event about the connection.  An event is any activity (received data, errors, 
  166. new connection with a remote, lost connection with a remote, etc.) related to the 
  167. connection.  When an event occurs, the control will fire the subroutine spx1_LinkEvent.  
  168.  
  169. Example:  
  170. Sub spx1_LinkEvent ()
  171.     Event% = spx1.Event
  172. End Sub
  173.  
  174. Status
  175. [form.]Control.Status [ = { 0}]
  176. (not applicable for IPX)
  177.  
  178. Status Initialization:
  179. 0     Disable
  180.  
  181. Status Information:
  182. 1     Control is listening for a connection
  183. 2     Control is trying to establish a connection
  184. 3     Control has established a connection, ready to send
  185. 4     Control is terminating the connection
  186.  
  187. Controls a connection and will contain status information.  Setting the Status property to 
  188. 0 will terminate any connection.
  189.  
  190. Example:  spx1.Status = 0     'Terminate any connection 
  191.  
  192. LinkType
  193. [form.]Control.LinkType [ = numericexpression]
  194. (not applicable for IPX)
  195.  
  196. Settings
  197. Default                    1
  198. 1                             establish a session with remote
  199. 2                             listen for connection
  200.  
  201. Set the control's mode of operation.  This may be changed at any time.
  202. Example:  spx1.LinkType = 2
  203.  
  204. LocalName
  205. [form.]Control.LocalName
  206.  
  207. Return Data Type    String * 12
  208.  
  209. Returns the internet address of the current workstation (network, node, and socket).
  210.  
  211. Example:  myAddress = spx1.LocalName
  212.  
  213. RemoteName
  214. [form.]Control.RemoteName[ = string expression]
  215.  
  216. Set the internet address that the control will use to send and receive data.  This may be 
  217. changed at any time.
  218.  
  219. Example:  spx1.RemoteName = yourAddress
  220.  
  221.  
  222. PacketType
  223. [form.]Control.PacketType [ = numericexpression]
  224. (not applicable for SPX)
  225.  
  226. Sets the Packet Type field in the IPX header.
  227.  
  228. Settings
  229. Default                    0
  230. 0                             UnKnown packet 
  231. 4                             IPX Packet
  232.  
  233. Example:  ipx1.PacketType = 4
  234.  
  235. TaskID
  236. [form.]Control.TaskID
  237.  
  238. Return Data Type    Long
  239.  
  240. Returns the task ID from NWIPXSPX.DLL for the current task.
  241.  
  242. Example:  myTaskID = spx1.TaskID
  243.  
  244.  
  245. Control Events
  246.  
  247. LinkEvent()
  248.  
  249. This event is called each time an event for a connection occurs.  An event might be an 
  250. IPX/SPX error or an event listed in the event table.  The application should check the 
  251. value of the Event property during this event.
  252.  
  253. Example:
  254. Sub spx1_LinkEvent()
  255.     Event% = spx1.Event()
  256. End Sub
  257.  
  258. ReceiveData()
  259.  
  260. This event is called each time data is received.  The application should retrieve the value of 
  261. Received during this event.
  262.  
  263. Example:
  264. Sub spx1_ReceiveData()
  265.     Data$ = spx1.Received()
  266.  End Sub
  267.  
  268. SentData()
  269.  
  270. This event is called each time the control has transmitted data.  
  271.  
  272. Example:
  273. Sub spx1_SentData()
  274.      ' Ready to send next packet
  275.  End Sub
  276.  
  277.  
  278.  
  279.  
  280. Example Applications
  281.  
  282. NETCHAT.MAK
  283.  
  284. This example application uses the IPX control to send IPX packets to another workstation 
  285. and allow the users to chat to one another.  The application uses a simple protocol and 
  286. finite state machine to connect to another application, send and receive data, and then 
  287. disconnect from the other application.  This application also uses several calls provided by 
  288. NWCALLS.DLL to find all the other users and their internet addresses.
  289.  
  290. CLIENT.MAK & SERVER.MAK
  291.  
  292. These two examples demonstrate the SPX control in a simple client/server protocol.  The 
  293. client application sends a directory command to the server, which returns a directory  
  294. listing of the server's current directory.  To set an application, all that is needed is to set 
  295. the LinkType property to 2. To be a client, set the LinkType property to 1.
  296.  
  297. Event Values
  298.  
  299. Any of the following events will trigger a spx1_LinkEvent call.  The value returned by 
  300. Event is listed in the left column and its meaning is listed on the right.
  301.  
  302. 237            Abnormal Connection Termination
  303.  
  304. 238            Invalid Connection
  305.  
  306. 239            Connection Table Full
  307.  
  308. 241            IPX/SPX Not Installed
  309.  
  310. 242            No DOS Memory
  311.  
  312. 243            No Free ECB
  313.  
  314. 244            Lock Failed
  315.  
  316. 245            Over the Maximum Limit
  317.  
  318. 246            IPX/SPX Previously Initialized
  319.  
  320. 252            Socket Not Opened
  321.             SPX Command Canceled with IPXCancelEvent
  322.  
  323. 253            Malformed Packet
  324.             SPX Packet Overflow
  325.  
  326. 255            SPX Socket Not Opened
  327.  
  328.  
  329. Visual Basic Errors
  330.  
  331. The following is a list of special errors than can be returned by the IPX/SPX custom 
  332. controls.  The value in the left column is the error code returned in the Visual Basic "Err" 
  333. variable and its meaning is on the right.
  334.  
  335. 22001        IPX not installed
  336. 22002        SPX not installed
  337. 22003        Currently only 1 user allowed
  338. 22004        Socket not opened 
  339.  
  340.  
  341. Visual Basic is a trademark of Microsoft Corporation.
  342. Windows is a registered trademark of Microsoft Corporation.
  343. IPX/SPX, NetWare are registered trademarks of Novell, Inc.
  344. Xerox Network System is a registered trademark of Xerox.
  345. IPXSPX.DOC
  346.  
  347.  
  348.