java.net.ServerSocket.implAccept()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(228)

本文整理了Java中java.net.ServerSocket.implAccept()方法的一些代码示例,展示了ServerSocket.implAccept()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ServerSocket.implAccept()方法的具体详情如下:
包路径:java.net.ServerSocket
类名称:ServerSocket
方法名:implAccept

ServerSocket.implAccept介绍

[英]Invokes the server socket implementation to accept a connection on the given socket aSocket.
[中]调用服务器套接字实现以接受给定套接字aSocket上的连接。

代码示例

代码示例来源:origin: robovm/robovm

  1. /**
  2. * Waits for an incoming request and blocks until the connection is opened.
  3. * This method returns a socket object representing the just opened
  4. * connection.
  5. *
  6. * @return the connection representing socket.
  7. * @throws IOException
  8. * if an error occurs while accepting a new connection.
  9. */
  10. public Socket accept() throws IOException {
  11. checkOpen();
  12. if (!isBound()) {
  13. throw new SocketException("Socket is not bound");
  14. }
  15. Socket aSocket = new Socket();
  16. try {
  17. implAccept(aSocket);
  18. } catch (IOException e) {
  19. aSocket.close();
  20. throw e;
  21. }
  22. return aSocket;
  23. }

代码示例来源:origin: robovm/robovm

  1. public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  2. Socket clientSocket = clientSocketChannel.socket();
  3. boolean connectOK = false;
  4. try {
  5. synchronized (this) {
  6. super.implAccept(clientSocket);
  7. clientSocketChannel.setConnected();
  8. clientSocketChannel.setBound(true);
  9. clientSocketChannel.finishAccept();
  10. }
  11. connectOK = true;
  12. } finally {
  13. if (!connectOK) {
  14. clientSocket.close();
  15. }
  16. }
  17. return clientSocket;
  18. }

代码示例来源:origin: stackoverflow.com

  1. "Monitor Ctrl-Break" daemon prio=6 tid=0x0000000006b98000 nid=0x1d70 runnable [0x00000000074df000]
  2. java.lang.Thread.State: RUNNABLE
  3. at java.net.PlainSocketImpl.socketAccept(Native Method)
  4. at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408)
  5. - locked <0x00000007d5d53148> (a java.net.SocksSocketImpl)
  6. at java.net.ServerSocket.implAccept(ServerSocket.java:462)
  7. at java.net.ServerSocket.accept(ServerSocket.java:430)
  8. at com.intellij.rt.execution.application.AppMain$1.run(AppMain.java:82)
  9. at java.lang.Thread.run(Thread.java:662)
  10. Locked ownable synchronizers:
  11. - None
  12. ...

代码示例来源:origin: org.apache.qpid/qpid-broker-plugins-management-jmx

  1. @Override
  2. public Socket accept() throws IOException
  3. {
  4. Socket s = new NoLocalAddressSocket();
  5. super.implAccept(s);
  6. return s;
  7. }
  8. }

代码示例来源:origin: stackoverflow.com

  1. at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408)
  2. - locked <7b20d3f08> (a java.net.SocksSocketImpl)
  3. at java.net.ServerSocket.implAccept(ServerSocket.java:462)
  4. at java.net.ServerSocket.accept(ServerSocket.java:430)
  5. at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61)

代码示例来源:origin: stackoverflow.com

  1. public class AuditableClientServerSocket extends ServerSocket {
  2. // Constructors removed for brevity. Add them back here
  3. @Override
  4. public Socket accept() throws IOException {
  5. if (isClosed())
  6. throw new SocketException("Socket is closed");
  7. if (!isBound())
  8. throw new SocketException("Socket is not bound yet");
  9. final Socket s = new AuditableClientSocket((SocketImpl) null);
  10. implAccept(s);
  11. return s;
  12. }
  13. }

代码示例来源:origin: stackoverflow.com

  1. public class ServerClientSocket extends ServerSocket {
  2. public ClientSocket accept() throws IOException {
  3. if (isClosed())
  4. throw new SocketException("Socket is closed");
  5. if (!isBound())
  6. throw new SocketException("Socket is not bound yet");
  7. ClientSocket s = new ClientSocket((SocketImpl) null);
  8. implAccept(s);
  9. return s;
  10. }
  11. }

代码示例来源:origin: MobiVM/robovm

  1. /**
  2. * Waits for an incoming request and blocks until the connection is opened.
  3. * This method returns a socket object representing the just opened
  4. * connection.
  5. *
  6. * @return the connection representing socket.
  7. * @throws IOException
  8. * if an error occurs while accepting a new connection.
  9. */
  10. public Socket accept() throws IOException {
  11. checkOpen();
  12. if (!isBound()) {
  13. throw new SocketException("Socket is not bound");
  14. }
  15. Socket aSocket = new Socket();
  16. try {
  17. implAccept(aSocket);
  18. } catch (IOException e) {
  19. aSocket.close();
  20. throw e;
  21. }
  22. return aSocket;
  23. }

代码示例来源:origin: ibinti/bugvm

  1. /**
  2. * Waits for an incoming request and blocks until the connection is opened.
  3. * This method returns a socket object representing the just opened
  4. * connection.
  5. *
  6. * @return the connection representing socket.
  7. * @throws IOException
  8. * if an error occurs while accepting a new connection.
  9. */
  10. public Socket accept() throws IOException {
  11. checkOpen();
  12. if (!isBound()) {
  13. throw new SocketException("Socket is not bound");
  14. }
  15. Socket aSocket = new Socket();
  16. try {
  17. implAccept(aSocket);
  18. } catch (IOException e) {
  19. aSocket.close();
  20. throw e;
  21. }
  22. return aSocket;
  23. }

代码示例来源:origin: com.bugvm/bugvm-rt

  1. /**
  2. * Waits for an incoming request and blocks until the connection is opened.
  3. * This method returns a socket object representing the just opened
  4. * connection.
  5. *
  6. * @return the connection representing socket.
  7. * @throws IOException
  8. * if an error occurs while accepting a new connection.
  9. */
  10. public Socket accept() throws IOException {
  11. checkOpen();
  12. if (!isBound()) {
  13. throw new SocketException("Socket is not bound");
  14. }
  15. Socket aSocket = new Socket();
  16. try {
  17. implAccept(aSocket);
  18. } catch (IOException e) {
  19. aSocket.close();
  20. throw e;
  21. }
  22. return aSocket;
  23. }

代码示例来源:origin: com.gluonhq/robovm-rt

  1. /**
  2. * Waits for an incoming request and blocks until the connection is opened.
  3. * This method returns a socket object representing the just opened
  4. * connection.
  5. *
  6. * @return the connection representing socket.
  7. * @throws IOException
  8. * if an error occurs while accepting a new connection.
  9. */
  10. public Socket accept() throws IOException {
  11. checkOpen();
  12. if (!isBound()) {
  13. throw new SocketException("Socket is not bound");
  14. }
  15. Socket aSocket = new Socket();
  16. try {
  17. implAccept(aSocket);
  18. } catch (IOException e) {
  19. aSocket.close();
  20. throw e;
  21. }
  22. return aSocket;
  23. }

代码示例来源:origin: FlexoVM/flexovm

  1. /**
  2. * Waits for an incoming request and blocks until the connection is opened.
  3. * This method returns a socket object representing the just opened
  4. * connection.
  5. *
  6. * @return the connection representing socket.
  7. * @throws IOException
  8. * if an error occurs while accepting a new connection.
  9. */
  10. public Socket accept() throws IOException {
  11. checkOpen();
  12. if (!isBound()) {
  13. throw new SocketException("Socket is not bound");
  14. }
  15. Socket aSocket = new Socket();
  16. try {
  17. implAccept(aSocket);
  18. } catch (IOException e) {
  19. aSocket.close();
  20. throw e;
  21. }
  22. return aSocket;
  23. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. /**
  2. * Waits for an incoming request and blocks until the connection is opened.
  3. * This method returns a socket object representing the just opened
  4. * connection.
  5. *
  6. * @return the connection representing socket.
  7. * @throws IOException
  8. * if an error occurs while accepting a new connection.
  9. */
  10. public Socket accept() throws IOException {
  11. checkOpen();
  12. if (!isBound()) {
  13. throw new SocketException("Socket is not bound");
  14. }
  15. Socket aSocket = new Socket();
  16. try {
  17. implAccept(aSocket);
  18. } catch (IOException e) {
  19. aSocket.close();
  20. throw e;
  21. }
  22. return aSocket;
  23. }

代码示例来源:origin: MobiVM/robovm

  1. public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  2. Socket clientSocket = clientSocketChannel.socket();
  3. boolean connectOK = false;
  4. try {
  5. synchronized (this) {
  6. super.implAccept(clientSocket);
  7. clientSocketChannel.setConnected();
  8. clientSocketChannel.setBound(true);
  9. clientSocketChannel.finishAccept();
  10. }
  11. connectOK = true;
  12. } finally {
  13. if (!connectOK) {
  14. clientSocket.close();
  15. }
  16. }
  17. return clientSocket;
  18. }

代码示例来源:origin: ibinti/bugvm

  1. public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  2. Socket clientSocket = clientSocketChannel.socket();
  3. boolean connectOK = false;
  4. try {
  5. synchronized (this) {
  6. super.implAccept(clientSocket);
  7. clientSocketChannel.setConnected();
  8. clientSocketChannel.setBound(true);
  9. clientSocketChannel.finishAccept();
  10. }
  11. connectOK = true;
  12. } finally {
  13. if (!connectOK) {
  14. clientSocket.close();
  15. }
  16. }
  17. return clientSocket;
  18. }

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

  1. public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  2. Socket clientSocket = clientSocketChannel.socket();
  3. boolean connectOK = false;
  4. try {
  5. synchronized (this) {
  6. super.implAccept(clientSocket);
  7. clientSocketChannel.setConnected();
  8. clientSocketChannel.setBound(true);
  9. clientSocketChannel.finishAccept();
  10. }
  11. connectOK = true;
  12. } finally {
  13. if (!connectOK) {
  14. clientSocket.close();
  15. }
  16. }
  17. return clientSocket;
  18. }

代码示例来源:origin: com.bugvm/bugvm-rt

  1. public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  2. Socket clientSocket = clientSocketChannel.socket();
  3. boolean connectOK = false;
  4. try {
  5. synchronized (this) {
  6. super.implAccept(clientSocket);
  7. clientSocketChannel.setConnected();
  8. clientSocketChannel.setBound(true);
  9. clientSocketChannel.finishAccept();
  10. }
  11. connectOK = true;
  12. } finally {
  13. if (!connectOK) {
  14. clientSocket.close();
  15. }
  16. }
  17. return clientSocket;
  18. }

代码示例来源:origin: com.gluonhq/robovm-rt

  1. public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  2. Socket clientSocket = clientSocketChannel.socket();
  3. boolean connectOK = false;
  4. try {
  5. synchronized (this) {
  6. super.implAccept(clientSocket);
  7. clientSocketChannel.setConnected();
  8. clientSocketChannel.setBound(true);
  9. clientSocketChannel.finishAccept();
  10. }
  11. connectOK = true;
  12. } finally {
  13. if (!connectOK) {
  14. clientSocket.close();
  15. }
  16. }
  17. return clientSocket;
  18. }

代码示例来源:origin: FlexoVM/flexovm

  1. public Socket implAccept(SocketChannelImpl clientSocketChannel) throws IOException {
  2. Socket clientSocket = clientSocketChannel.socket();
  3. boolean connectOK = false;
  4. try {
  5. synchronized (this) {
  6. super.implAccept(clientSocket);
  7. clientSocketChannel.setConnected();
  8. clientSocketChannel.setBound(true);
  9. clientSocketChannel.finishAccept();
  10. }
  11. connectOK = true;
  12. } finally {
  13. if (!connectOK) {
  14. clientSocket.close();
  15. }
  16. }
  17. return clientSocket;
  18. }

代码示例来源:origin: stackoverflow.com

  1. implAccept(s);
  2. return s;

相关文章