Library functions
The following listing provides BASIC functions with the same names and parameters as the corresponding function in most libraries for the 'C' programming language as a convenience for use.
This is taken verbatim from the original documentation:
1REM Network functions
2REM (C)2010 SPROW
3:
4DEFFNgethost(name$)
5wordblk?0=8:REM Parameters in
6wordblk?1=24:REM Parameters out
7wordblk?2=&41:REM Resolver_GetHost
8wordblk?3=0:REM No error on entry
9wordblk!4=nameblk
10$nameblk=name$
11A%=192:X%=wordblk:Y%=wordblk DIV256:CALL&FFF1
12IFwordblk?3<>0 THEN=0
13=wordblk+4:REM Address not value
14:
15DEFFNcreat(pf%,type%,prot%)
16wordblk?0=16:REM Parameters in
17wordblk?1=8:REM Parameters out
18wordblk?2=&00:REM Socket_Creat
19wordblk?3=0:REM No error on entry
20wordblk!4=pf%
21wordblk!8=type%
22wordblk!12=prot%
23A%=192:X%=wordblk:Y%=wordblk DIV256:CALL&FFF1
24IFwordblk?3<>0 THEN=-1
25=wordblk!4
26:
27DEFFNbind(handle%,addr%,addrlen%)
28wordblk?0=16:REM Parameters in
29wordblk?1=8:REM Parameters out
30wordblk?2=&01:REM Socket_Bind
31wordblk?3=0:REM No error on entry
32wordblk!4=handle%
33wordblk!8=addr%
34wordblk!12=addrlen%
35A%=192:X%=wordblk:Y%=wordblk DIV256:CALL&FFF1
36IFwordblk?3<>0 THEN=-1
37=wordblk!4
38:
39DEFFNlisten(handle%,count%)
40wordblk?0=12:REM Parameters in
41wordblk?1=8:REM Parameters out
42wordblk?2=&02:REM Socket_Listen
43wordblk?3=0:REM No error on entry
44wordblk!4=handle%
45wordblk!8=count%
46A%=192:X%=wordblk:Y%=wordblk DIV256:CALL&FFF1
47IFwordblk?3<>0 THEN=-1
48=wordblk!4
49:
50DEFFNaccept(handle%,addr%,addrlenblk%)Network programmer's API
51wordblk?0=16:REM Parameters in
52wordblk?1=8:REM Parameters out
53wordblk?2=&03:REM Socket_Accept
54wordblk?3=0:REM No error on entry
55wordblk!4=handle%
56wordblk!8=addr%
57wordblk!12=addrlenblk%
58A%=192:X%=wordblk:Y%=wordblk DIV256:CALL&FFF1
59IFwordblk?3<>0 THEN=-1
60=wordblk!4
61:
62DEFFNconnect(handle%,addr%,addrlen%)
63wordblk?0=16:REM Parameters in
64wordblk?1=8:REM Parameters out
65wordblk?2=&04:REM Socket_Connect
66wordblk?3=0:REM No error on entry
67wordblk!4=handle%
68wordblk!8=addr%
69wordblk!12=addrlen%
70A%=192:X%=wordblk:Y%=wordblk DIV256:CALL&FFF1
71IFwordblk?3<>0 THEN=-1
72=wordblk!4
73:
74DEFFNrecv(handle%,data%,len%,opts%)
75wordblk?0=20:REM Parameters in
76wordblk?1=8:REM Parameters out
77wordblk?2=&05:REM Socket_Recv
78wordblk?3=0:REM No error on entry
79wordblk!4=handle%
80wordblk!8=data%
81wordblk!12=len%
82wordblk!16=opts%
83A%=192:X%=wordblk:Y%=wordblk DIV256:CALL&FFF1
84IFwordblk?3<>0 THEN=-1
85=wordblk!4
86:
87DEFFNsend(handle%,data%,len%,opts%)
88wordblk?0=20:REM Parameters in
89wordblk?1=8:REM Parameters out
90wordblk?2=&08:REM Socket_Send
91wordblk?3=0:REM No error on entry
92wordblk!4=handle%
93wordblk!8=data%
94wordblk!12=len%
95wordblk!16=opts%
96A%=192:X%=wordblk:Y%=wordblk DIV256:CALL&FFF1
97IFwordblk?3<>0 THEN=-1
98=wordblk!4
99:
100DEFPROCshutdown(handle%,type%)
101wordblk?0=12:REM Parameters in
102wordblk?1=4:REM Parameters out
103wordblk?2=&0B:REM Socket_Shutdown
104wordblk?3=0:REM No error on entry
105wordblk!4=handle%Network programmer's API
106wordblk!8=type%
107A%=192:X%=wordblk:Y%=wordblk DIV256:CALL&FFF1
108ENDPROC
109:
110DEFPROCclose(handle%)
111wordblk?0=8:REM Parameters in
112wordblk?1=4:REM Parameters out
113wordblk?2=&10:REM Socket_Close
114wordblk?3=0:REM No error on entry
115wordblk!4=handle%
116A%=192:X%=wordblk:Y%=wordblk DIV256:CALL&FFF1
117ENDPROC
Last modified October 6, 2021: Move BBC content into subdirectory to allow more bbc content (23080e8)