/** * Use this constructor to create a server ACSE SAP that listens on a fixed port. The server socket is created with * the given socket factory. * * @param port * the local port listen on * @param backlog * the backlog * @param bindAddr * the InetAddress to bind to * @param associationListener * the AssociationListener that will be notified when remote clients have associated. Once constructed * the AcseSAP contains a public TSAP that can be accessed to set its configuration. * @param serverSocketFactory * the server socket factory to create the socket */ public ServerAcseSap(int port, int backlog, InetAddress bindAddr, AcseAssociationListener associationListener, ServerSocketFactory serverSocketFactory) { this.associationListener = associationListener; serverTSap = new ServerTSap(port, backlog, bindAddr, this, serverSocketFactory); }
/** * Start listening for incoming connections. Only for server SAPs. * * @throws IOException * if an error occures starting to listen */ public void startListening() throws IOException { if (associationListener == null || serverTSap == null) { throw new IllegalStateException("AcseSAP is unable to listen because it was not initialized."); } serverTSap.startListening(); }
public void stopListening() { serverTSap.stopListening(); }
ServerTSap serverTSAP = new ServerTSap(port, new SampleServer()); serverTSAP.startListening(); serverTSAP.stopListening();
/** * Sets the message fragment timeout. This is the timeout that the socket timeout is set to after the first byte of * a message has been received. If such a timeout is thrown, the association/socket is closed. * * @param timeout * the message fragment timeout in milliseconds. The default is 60000. */ public void setMessageFragmentTimeout(int timeout) { acseSap.serverTSap.setMessageFragmentTimeout(timeout); }
/** * Creates a server socket waiting on the configured port for incoming association requests. * * @param serverEventListener * the listener that is notified of incoming writes and when the server stopped listening for new * connections. * @throws IOException * if an error occurs binding to the port. */ public void startListening(ServerEventListener serverEventListener) throws IOException { timer = new Timer(); if (serverSocketFactory == null) { serverSocketFactory = ServerSocketFactory.getDefault(); } acseSap = new ServerAcseSap(port, backlog, bindAddr, new AcseListener(this), serverSocketFactory); acseSap.serverTSap.setMaxConnections(maxAssociations); this.serverEventListener = serverEventListener; listening = true; acseSap.startListening(); }
@Test public void testClientServerCom() throws IOException, InterruptedException { int port = 14322; ServerAcseSap serverAcseSAP = new ServerAcseSap(port, 0, null, new SampleServer()); serverAcseSAP.serverTSap.setMessageTimeout(6000); serverAcseSAP.startListening(); Socket socket = new Socket("localhost", port); DataOutputStream dataOutputStream = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream())); dataOutputStream.write(iso8073ConPacket); dataOutputStream.write(mmsConPacket); dataOutputStream.flush(); Thread.sleep(2000); Assert.assertTrue(success); serverAcseSAP.stopListening(); }
/** * Sets the message fragment timeout. This is the timeout that the socket timeout is set to after the first byte of * a message has been received. If such a timeout is thrown, the association/socket is closed. * * @param timeout * the message fragment timeout in milliseconds. The default is 60000. */ public void setMessageFragmentTimeout(int timeout) { acseSap.serverTSap.setMessageFragmentTimeout(timeout); }
/** * Creates a server socket waiting on the configured port for incoming association requests. * * @param serverEventListener * the listener that is notified of incoming writes and when the server stopped listening for new * connections. * @throws IOException * if an error occurs binding to the port. */ public void startListening(ServerEventListener serverEventListener) throws IOException { timer = new Timer(); if (serverSocketFactory == null) { serverSocketFactory = ServerSocketFactory.getDefault(); } acseSap = new ServerAcseSap(port, backlog, bindAddr, new AcseListener(this), serverSocketFactory); acseSap.serverTSap.setMaxConnections(maxAssociations); this.serverEventListener = serverEventListener; listening = true; acseSap.startListening(); }
/** * Start listening for incoming connections. Only for server SAPs. * * @throws IOException * if an error occures starting to listen */ public void startListening() throws IOException { if (associationListener == null || serverTSap == null) { throw new IllegalStateException("AcseSAP is unable to listen because it was not initialized."); } serverTSap.startListening(); }
public void stopListening() { serverTSap.stopListening(); }
/** * Use this constructor to create a server ACSE SAP that listens on a fixed port. The server socket is created with * the given socket factory. * * @param port * the local port listen on * @param backlog * the backlog * @param bindAddr * the InetAddress to bind to * @param associationListener * the AssociationListener that will be notified when remote clients have associated. Once constructed * the AcseSAP contains a public TSAP that can be accessed to set its configuration. * @param serverSocketFactory * the server socket factory to create the socket */ public ServerAcseSap(int port, int backlog, InetAddress bindAddr, AcseAssociationListener associationListener, ServerSocketFactory serverSocketFactory) { this.associationListener = associationListener; serverTSap = new ServerTSap(port, backlog, bindAddr, this, serverSocketFactory); }
/** * Start listening for incoming connections. Only for server SAPs. * * @throws IOException * if an error occures starting to listen */ public void startListening() throws IOException { if (associationListener == null || serverTSap == null) { throw new IllegalStateException("AcseSAP is unable to listen because it was not initialized."); } serverTSap.startListening(); }
public void stopListening() { serverTSap.stopListening(); }
/** * Use this constructor to create a server ACSE SAP that listens on a fixed port. The server socket is created with * the given socket factory. * * @param port * the local port listen on * @param backlog * the backlog * @param bindAddr * the InetAddress to bind to * @param associationListener * the AssociationListener that will be notified when remote clients have associated. Once constructed * the AcseSAP contains a public TSAP that can be accessed to set its configuration. * @param serverSocketFactory * the server socket factory to create the socket */ public ServerAcseSap(int port, int backlog, InetAddress bindAddr, AcseAssociationListener associationListener, ServerSocketFactory serverSocketFactory) { this.associationListener = associationListener; serverTSap = new ServerTSap(port, backlog, bindAddr, this, serverSocketFactory); }