コード例 #1
0
from libpandaexpress import BufferedDatagramConnection
from libpandaexpress import SocketAddress
from libpandaexpress import SocketIP
from libpandaexpress import SocketTCP
from libpandaexpress import SocketTCPListen
from libpandaexpress import SocketUDPOutgoing
from libpandaexpress import SocketUDPIncoming
from libpandaexpress import Datagram

import time



SocketIP.InitNetworkDriver();

addr = SocketAddress()
addr.setHost("127.0.0.1",6666)
print addr.getIpPort()

MyConection = BufferedDatagramConnection(0,4096000,4096000,102400);
#help(BufferedDatagramConnection)

MyConection.AddAddress(addr)

dg = Datagram();
dg.addUint8(1)
dg.addUint64(4001)
dg.addUint16(2001)
dg.addUint64(123456)

##MyConection.SendMessage(dg);
コード例 #2
0
from libpandaexpress import BufferedDatagramConnection
from libpandaexpress import SocketAddress
from libpandaexpress import SocketIP
from libpandaexpress import SocketTCP
from libpandaexpress import SocketTCPListen
from libpandaexpress import SocketUDPOutgoing
from libpandaexpress import SocketUDPIncoming


SocketIP.InitNetworkDriver();

addr = SocketAddress()
addr.setHost("127.0.0.1",8080)
print addr.getIpPort()


inbound = SocketTCPListen()
inbound.OpenForListen(addr);
##inbound.SetNonBlocking();

while 1 == 1:
    newsession = SocketTCP()
    source = SocketAddress()
    if inbound.GetIncomingConnection(newsession,source) :
        #newsession.SetNonBlocking();
        print source.getIpPort()    
        newsession.SendData("Hello From the Listener\n\r");    
        
        s = newsession.RecvData(10);            
        print s
        print newsession.GetLastError()
コード例 #3
0
from libpandaexpress import BufferedDatagramConnection
from libpandaexpress import SocketAddress
from libpandaexpress import SocketIP
from libpandaexpress import SocketTCP
from libpandaexpress import SocketTCPListen
from libpandaexpress import SocketUDPOutgoing
from libpandaexpress import SocketUDPIncoming


SocketIP.InitNetworkDriver();

addr = SocketAddress()
addr.setHost("127.0.0.1",8080)
print addr.getIpPort()


inbound = SocketTCPListen()
inbound.OpenForListen(addr);
##inbound.SetNonBlocking();

while 1 == 1:
    newsession = SocketTCP()
    source = SocketAddress()
    if inbound.GetIncomingConnection(newsession,source) :
        #newsession.SetNonBlocking();
        print source.getIpPort()
        newsession.SendData("Hello From the Listener\n\r");

        s = newsession.RecvData(10);
        print s
        print newsession.GetLastError()