TCP/IP 通信示例

TCP/IP 通信示例


Global String ReadData_P_All$, ReadData_P$(10), data$ '
Global Preserve Double x
Global Integer foundnumber_P

Function TCPServer
	   	SetNet #201, "192.168.0.1", 4000, CRLF, NONE, 0
	    OpenNet #201 As Client
	    WaitNet #201
	    Print "TCP Connected"
     	Integer i
    Do
         If ChkNet(201) > 0 Then
			  Line Input #201, ReadData_P_All$
	          Print "ReadData-p:", ReadData_P_All$
	          ParseStr ReadData_P_All$, ReadData_P$(), ","
	    		foundnumber_P = UBound(ReadData_P$())
	    	  Print "foundnumber_P=", foundnumber_P, "RP", Len(ReadData_P_All$)
		    	If ReadData_P$(UBound(ReadData_P$())) = "#" Then
    		  		For i = 0 To UBound(ReadData_P$())
    					ReadData_P$(i) = ""
					Next i
    		  	EndIf
		 EndIf
		If data$ <> "" Then
			Print #201, data$
			data$ = ""
		EndIf
    Loop
Fend


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值