|
2006/10/24(Tue) 21:25:15|NO.3072
サーバー側
sdim sky,50000
bload "winter.jpg",sky,-1
#include "hspsock.as"
*main
port=999
ipget
sockmake 0,port
if stat : dialog "Socket error": goto *errbye
a=0
repeat
sockwait 0
title "CHK="+stat+"/"+a
if stat>1 : dialog "Socket error": goto *errbye
if stat=0 : break
a+
wait 10
loop
wait 100
sockputb sky,0,50000,0
if stat=0 : dialog "sockputb": goto *errbye
*bye
sockclose
goto *main ; サーバーを続ける
*errbye
sockclose
mes "終了"
stop
クライアント側
sdim sky,50000
#include "hspsock.as"
adr="127.0.0.1"
port=999
mes adr+"、ポート"+port+"に接続中..."
sockopen 0,adr,port
if stat : dialog "socket error" : goto *bye
mes "接続しました..."
a=0
repeat
sockcheck 0
title "CHK="+stat+"/"+a
if stat!=0 : break
wait 10
a+
loop
sockgetb sky,0,50000,0
bsave "test.jpg",sky,100
if stat:end
*bye
mes "終了"
sockclose
stop
こんな感じです。
|