簡體   English   中英

在ATEasy中使用TCP

[英]Use of TCP in ATEasy

我想使用ATEasy創建服務器端程序,以便ATEasy測試將測試信息發送到LABWINDOWS\\CVI ,后者將實現客戶端。

我的問題是,有人在如何將ATEasy中的TCP套接字用作服務器時使用了很好的教程或示例嗎?

ATEasy示例中的Winsock示例不夠好,很難理解。

沒關系,我在ATEASY文檔中找到了這個。

在此處輸入圖片說明

例如:

    ! create the socket in TCP mode
    asASocket = WsCreate(aWsTcpIp)

    ! Attach the socket
    WsBind(asASocket,"12345" ,"127.0.0.1")

    ! Set the Socket to listen for an incoming connection from a client:
    WsListen(asASocket)

    ! Attempts to return a readwrite socket to the remote client in twenty seconds. 
    ! In this stage the client should be calling WsConnect()...
    newSocket=WsAccept(asASocket,20000) 

    ! Notice that we send ( and receive ) data with the new socket that was returned by WsAccept
    WsSend(newSocket,300, ,"HELLO, HOW ARE YOU?")

    ! Attempt to Receive data from the client
    ! the client should send a message using WsSend()...
    while True
    if WsReceive(newSocket, 1000, , sMessage)>0
        exitloop
    endif 
    endwhile

    ! print the message from the client
    print sMessage

    ! close the connection
    WsClose(newSocket)
    WsClose(asASocket)

以上每個函數都有一個返回值,應進行檢查。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM