5 T$="" 10 IN$="":S%=SELECT("bluetooth","server","client","exit") 20 IF S%=2 THEN END 30 IF S%=0 THEN GOTO 50 40 IF S%=1 THEN GOTO 100 50 REM server 60 T$=T$+BTSH$("server","")+CHR$(10) 70 MM%=MESSAGEFORM("bluetooth","send","disconnect","server",T$) 80 IF MM%=-1 THEN GOTO 290 90 GOSUB 320:T$=T$+BTSH$("receive",""):GOTO 70 100 REM servers 110 DIM BUF$(65536):N%=0 120 A$=BTSH$("servers","search") 130 IF A$="" THEN GOTO 170 140 BUF$(N%)=A$:N%=N%+1 150 A$=BTSH$("servers","") 160 GOTO 130 170 IF N%=0 THEN MM%=MESSAGEFORM("bluetooth","back","back","","devices not found!"):GOTO 10 180 DIM C$(N%) 190 FOR I%=0 TO N%-1 200 C$(I%)=BUF$(I%) 210 NEXT I% 220 MC%=CHOICEFORM("bluetooth","ok","disconnect","choose device:",C$,0) 230 IF MC%=-1 THEN GOTO 290 240 REM client 245 A$=BTSH$("clientname","bad boy") 250 T$=T$+BTSH$("client",STR$(MC%))+CHR$(10) 260 MM%=MESSAGEFORM("bluetooth","send","back","client",T$) 270 IF MM%=-1 THEN T$=T$+BTSH$("disconnect",""):GOTO 220 280 GOSUB 320:T$=T$+BTSH$("receive",""):GOTO 260 290 REM disconnect 300 T$=T$+BTSH$("disconnect","") 310 GOTO 10 320 REM send 330 ME%=EDITFORM("bluetooth","send!","back","send:",IN$,1000,0) 340 IF ME%=-1 THEN RETURN 350 T$=T$+BTSH$("send",IN$) 360 RETURN