.NET 용 비 차단 IO 프레임 워크가 있습니까?.NET 용 NIO 프레임 워크는 무엇입니까?
Apache Mina과 JBoss Netty이 Java를 제공하는 것과 유사한 것을 찾고 있습니다. .NET 프레임 워크가 제공하는 저수준 지원뿐만 아니라 확장 성이 뛰어난 서버를 구현하기위한 프레임 워크입니다.
편집 :
public class SimpleDecoder extends CumulativeProtocolDecoder {
protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception {
if (in.remaining() < 4)
return false;
int length = in.getInt();
if(in.remaining() < 4 + length)
return false;
Command command = new Command(in.asInputStream());
out.write(command);
}
}
: 미나에서
나는이 같은 ProtocolDecoder을 구현할 수 있습니다 더 나은 내가보고 싶은 것을 설명하기 위해, 여기에 당신이 미나와 함께 무엇을 할 수 있는지에 대한 기본적인 예입니다 이 같은
그리고 CommandHandler :
public abstract class CommandHandler extends IoHandlerAdapter{
public void messageReceived(IoSession session, Object message) throws IOException, CloneNotSupportedException {
Command command = (Command) message;
// Handle command. Probably by putting it in a workqueue.
}
}
내가
를 호출하여 서버를 시작하는 경우CommandHandler handler = new CommandHandler();
NioSocketAcceptor acceptor = new NioSocketAcceptor();
acceptor.getFilterChain().addLast("protocol", new ProtocolCodecFilter(new SimpleDecoder(false)));
acceptor.setLocalAddress(new InetSocketAddress(port));
acceptor.setHandler(handler);
acceptor.bind();
비 차단 서버를 제공합니다.
들어오는 모든 연결을 순환하고 소켓에서 데이터를 수집하며 SimpleDecoder.doDecode()
을 호출하여 연결에 대한 완전한 명령이 있는지 확인합니다. 그런 다음 명령을 CommandHandler.messageReceived()
으로 전달하면 처리를 대신 할 수 있습니다.
Java 용 NIO 프레임 워크는 다음과 같습니다. http://www.jboss.org/netty. 나는 .Net (그리고 나는 Rasmus가 그렇게한다고 가정했다.)과 동등한 것을 찾고있다. 비동기 IO뿐 아니라 개발을 간소화하는 프레임 워크입니다. – jgauffin
비 차단 I/O는 1 일부터 .NET에 포함되었습니다. 정확히 무엇을 찾고 계십니까? –
.NET에서 저수준 호출을 기반으로 서버 프레임 워크를 찾고 있습니다. –