Teste :: Poe :: Cliente :: TCP

Test :: Poe :: Client :: TCP é um componente PoE que fornece serviços de cliente TCP para casos de teste.
Baixe Agora

Teste :: Poe :: Cliente :: TCP Classificação e resumo

Propaganda

  • Rating:
  • Licença:
  • Perl Artistic License
  • Preço:
  • FREE
  • Nome do editor:
  • Chris Williams
  • Site do editor:
  • http://search.cpan.org/~bingos/

Teste :: Poe :: Cliente :: TCP Tag


Teste :: Poe :: Cliente :: TCP Descrição

Teste :: Poe :: Cliente :: TCP é um componente PoE que fornece serviços de cliente TCP para casos de teste. Teste :: Poe :: Cliente :: TCP é um componente PoE que fornece serviços de cliente TCP para casos de teste.synopsis use rigoroso; usar soquete; Use teste :: Mais testes => 15; Use PoE QW (roda :: SocketFactory Wheel :: Readwrite filter :: Line); Use teste :: Poe :: Cliente :: TCP; meu @data = ('Este é um teste', 'este é outro teste', 'este é o último teste',); Poe :: Session-> Create (Package_States => ,], heap => {data => @data,},); $ poe_kernel-> correr (); saída 0; sub _start {my ($ kernel, $ heap) = @_ ; $ heap -> {listener} = poe :: roda :: socketfactory-> new (BindAddress => '127.0.0.1', succept => '_accept', failureevent => '_failed', socketdomain => af_inet, # define o Soquete () SocketType => Sock_stream, # define o Socket () Type SocketProtocol => 'TCP', # define o protocolo do soquete () Reutilização => 'On', # permite que a porta seja reutilizada); $ heap -> {testc} = test :: poe :: cliente :: tcp-> spawn (); Retorna; } sub _accept {my ($ kernel, $ heap, $ soquete) = @_ ; My $ Wheel = Poe :: Roda :: ReadWrite-> Novo (manipular => $ soquete, inputevent => '_sock_in', erforevent => '_sock_err',); $ heap -> {wheels} -> {$ wheel-> id} = $ roda; Retorna; } sub _failed {my ($ kernel, $ heap, $ operação, $ errnum, $ errstr, $ wheel_id) = @_ ; morrer "roda $ wheel_id gerado erro de $ operação $ errnum: $ errstrn"; Retorna; } sub _sock_in {my ($ heap, $ Entrada, $ wheel_id) = @_ ; Passe ('recebeu entrada do cliente'); $ heap -> {Wheels} -> {$ wheel_id} -> Coloque ($ Entrada) Se $ heap -> {rodas} -> {$ wheel_id}; Retorna; } sub _sock_err {my ($ heap, $ wheel_id) = @_ ; Passe ('Cliente desconectado'); excluir $ heap -> {Wheels} -> {$ wheel_id}; Retorna; } subestc_registered {My ($ kernel, $ remetente, $ objeto) = @_ ; passar ($ _ ); Minha $ Port = (SockaddR_IN ($ _ -> {listener} -> getockname ())) ; $ kernel-> post ($ remetente, 'conectar', {endereço => '127.0.0.1', port => $ portas}); Retorna; } subestc_conectado {my ($ kernel, $ heap, $ remetente) = @_ ; passar ($ _ ); $ kernel-> post ($ remetente, 'send_to_server', $ heap -> {Data} -> ); Retorna; } Sub testc_flushed {pass ($ _ ); Retorna; } sub testc_input {my ($ heap, $ input) = @_ ; passar ('tem algo de volta do servidor'); Meus $ Data = Shift @ {$ heap -> {Data}}; OK ($ Entrada EQ $ Dados, "Dados correspondidos: '$ Entrada'"); a menos que (escalar @ {$ heap -> {dados}}) {$ heap -> {testc} -> terminar (); Retorna; } $ Poe_Kernel-> Post ($ _ , 'send_to_server', $ heap -> {Data} -> ); Retorna; } subestc_disconnected {my ($ heap, $ state) = @_ ; passe ($ estado); excluir $ heap -> {rodas}; excluir $ heap -> {listener}; $ heap -> {testc} -> desligamento (); Retorna; } Requisitos: · Perl.


Teste :: Poe :: Cliente :: TCP Software Relacionado