当前位置: 首页>>代码示例>>Java>>正文


Java SocketException.getMessage方法代码示例

本文整理汇总了Java中java.net.SocketException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java SocketException.getMessage方法的具体用法?Java SocketException.getMessage怎么用?Java SocketException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.net.SocketException的用法示例。


在下文中一共展示了SocketException.getMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import java.net.SocketException; //导入方法依赖的package包/类
private void init() {

        ServerSocketChannel socketChannel = processor.javaChannel();

        ServerSocket javaSocket = socketChannel.socket();

        try {
            if (serverConfig.getReceiveBufferSize() != null) {
                javaSocket.setReceiveBufferSize(serverConfig.getReceiveBufferSize());
            }
            if (serverConfig.getReuseAddress() != null) {
                javaSocket.setReuseAddress(serverConfig.getReuseAddress());
            }
        } catch (SocketException e) {
            throw new NioException("config channel error:" + e.getMessage(), e);
        }
    }
 
开发者ID:lemonJun,项目名称:TakinRPC,代码行数:18,代码来源:NioServer.java

示例2: getAllHostAddress

import java.net.SocketException; //导入方法依赖的package包/类
public static Collection<InetAddress> getAllHostAddress() {
    try {
        Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
        Collection<InetAddress> addresses = new ArrayList<InetAddress>();

        while (networkInterfaces.hasMoreElements()) {
            NetworkInterface networkInterface = networkInterfaces.nextElement();
            Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
            while (inetAddresses.hasMoreElements()) {
                InetAddress inetAddress = inetAddresses.nextElement();
                addresses.add(inetAddress);
            }
        }

        return addresses;
    } catch (SocketException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}
 
开发者ID:wolfboys,项目名称:opencron,代码行数:20,代码来源:IPUtils.java

示例3: sendRtmpPacket

import java.net.SocketException; //导入方法依赖的package包/类
private void sendRtmpPacket(RtmpPacket rtmpPacket) {
  try {
    ChunkStreamInfo chunkStreamInfo =
        rtmpSessionInfo.getChunkStreamInfo(rtmpPacket.getHeader().getChunkStreamId());
    chunkStreamInfo.setPrevHeaderTx(rtmpPacket.getHeader());
    if (!(rtmpPacket instanceof Video || rtmpPacket instanceof Audio)) {
      rtmpPacket.getHeader()
          .setAbsoluteTimestamp((int) chunkStreamInfo.markAbsoluteTimestampTx());
    }
    rtmpPacket.writeTo(outputStream, rtmpSessionInfo.getTxChunkSize(), chunkStreamInfo);
    Log.d(TAG,
        "wrote packet: " + rtmpPacket + ", size: " + rtmpPacket.getHeader().getPacketLength());
    if (rtmpPacket instanceof Command) {
      rtmpSessionInfo.addInvokedCommand(((Command) rtmpPacket).getTransactionId(),
          ((Command) rtmpPacket).getCommandName());
    }
    outputStream.flush();
  } catch (SocketException se) {
    // Since there are still remaining AV frame in the cache, we set a flag to guarantee the
    // socket exception only issue one time.
    if (!socketExceptionCause.contentEquals(se.getMessage())) {
      socketExceptionCause = se.getMessage();
      connectCheckerRtmp.onConnectionFailedRtmp("Error send packet: " + se.getMessage());
      Log.e(TAG, "Caught SocketException during write loop, shutting down: " + se.getMessage());
    }
  } catch (IOException ioe) {
    Log.e(TAG, "Caught IOException during write loop, shutting down: " + ioe.getMessage());
  }
}
 
开发者ID:pedroSG94,项目名称:rtmp-rtsp-stream-client-java,代码行数:30,代码来源:RtmpConnection.java

示例4: treatAsBindException

import java.net.SocketException; //导入方法依赖的package包/类
public static boolean treatAsBindException(SocketException se) {
  if (se instanceof BindException) {
    return true;
  }
  final String msg = se.getMessage();
  return (msg != null && msg.contains("Invalid argument: listen failed"));
}
 
开发者ID:ampool,项目名称:monarch,代码行数:8,代码来源:AcceptorImpl.java


注:本文中的java.net.SocketException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。