home *** CD-ROM | disk | FTP | other *** search
/ Millennium Time Capsule / AC2000.BIN / disks / ac9_disk / net157 / netinc1.bas < prev    next >
Encoding:
BASIC Source File  |  1997-08-06  |  2.2 KB  |  128 lines

  1.  
  2. LIBRARY "networld"
  3. DEFINT a-z
  4.  
  5. REM $include transprt.bh
  6.  
  7. REM This is an include file for NetWorld. It creates functions that will
  8. REM let you connect to the internet quickly and painlessly. Well, just!
  9. REM :-)
  10.  
  11. DIM SHARED stikinitialised
  12.  
  13. DEF FNgerrtxt$ (er)
  14. LOCAL s$,e&,d
  15. e&=FNget_err_text& (er)
  16. DO
  17.     d=PEEKB (e&)
  18.     IF d=0 THEN EXIT DO
  19.     s$=s$+CHR$(d)
  20.     INCR e&
  21. LOOP
  22. FNgerrtxt$=s$
  23. s$="" : e&=0 : d=0
  24. END DEF
  25.  
  26. DEF FNgvstr$ (er$)
  27. LOCAL s$,er$,d,e&
  28. er$=er$+CHR$(0)
  29. e&=FNgetvstr& (VARPTR(er$))
  30. DO
  31.     d=PEEKB (e&)
  32.     IF d=0 THEN EXIT DO
  33.     s$=s$+CHR$(d)
  34.     INCR e&
  35. LOOP
  36. FNgvstr$=s$
  37. s$="" : e&=0 : d=0 : er$=""
  38. END DEF
  39.  
  40. DEF FNtcp_author$
  41. LOCAL s$,er$,d,e&,b(1)
  42. e&=FNtcp_author& (b())
  43. DO
  44.     d=PEEKB (e&)
  45.     IF d=0 THEN EXIT DO
  46.     s$=s$+CHR$(d)
  47.     INCR e&
  48. LOOP
  49. FNtcp_author$=s$
  50. s$="" : e&=0 : d=0 : er$=""
  51. END DEF
  52.  
  53. DEF FNtcp_version$
  54. LOCAL s$,er$,d,e&,b(1)
  55. e&=FNtcp_version& (b())
  56. DO
  57.     d=PEEKB (e&)
  58.     IF d=0 THEN EXIT DO
  59.     s$=s$+CHR$(d)
  60.     INCR e&
  61. LOOP
  62. FNtcp_version$=s$
  63. s$="" : e&=0 : d=0 : er$=""
  64. END DEF
  65.  
  66. DEF FNtcp_module$
  67. LOCAL s$,er$,d,e&,b(1)
  68. e&=FNtcp_module& (b())
  69. DO
  70.     d=PEEKB (e&)
  71.     IF d=0 THEN EXIT DO
  72.     s$=s$+CHR$(d)
  73.     INCR e&
  74. LOOP
  75. FNtcp_module$=s$
  76. s$="" : e&=0 : d=0 : er$=""
  77. END DEF
  78.  
  79. DEF FNnetworldver$
  80. LOCAL s$,er$,d,e&,b(1)
  81. e&=FNnetwldver& (b())
  82. DO
  83.     d=PEEKB (e&)
  84.     IF d=0 THEN EXIT DO
  85.     s$=s$+CHR$(d)
  86.     INCR e&
  87. LOOP
  88. FNnetworldver$=s$
  89. s$="" : e&=0 : d=0 : er$=""
  90. END DEF
  91.  
  92. DEF FNTCP_connect (domain$, port, tos, alloc)
  93. LOCAL a,num,anum&,x,TCP_cnnect,dum(1)
  94.  
  95. domain$=domain$+CHR$(0)
  96. num=FNresolve (VARPTR(domain$),0,VARPTR(anum&),1)
  97. IF num<0 THEN
  98. '    a=FNform_alert (1,"[1][ Resolve returns: | "+gerrtxt$(num)+" | ][ OK ]")
  99.     TCP_cnnect=-1
  100. END IF
  101.  
  102. x=FNTCP_open (anum&, port, tos, alloc)
  103. IF x<0 THEN
  104. '    a=FNform_alert (1,"[1][ TCP_open returns: | "+gerrtxt$(x)+" | ][ OK ]")
  105.     TCP_cnnect=-1
  106. END IF
  107.  
  108. IF TCP_cnnect<>-1 THEN FNTCP_connect=x ELSE FNTCP_connect=-1
  109.  
  110. END DEF
  111.  
  112. SUB initnetworld
  113. LOCAL a,b(1)
  114. a=FNinitstik (b())
  115. 'IF a<1 THEN a=FNform_alert (1,"[3][ STiK not installed | correctly! ][ OK ]")
  116. stikinitialised=a
  117. END SUB
  118.  
  119. DEF FNtcpsend (cn,mess$)
  120. LOCAL x
  121.  
  122. mess$=mess$+CHR$(13)+CHR$(10)
  123. x=FNtcp_send (cn,VARPTR(mess$),LEN(mess$))
  124. FNtcpsend=x
  125.  
  126. END DEF
  127.  
  128. initnetworld