Home  >  Q&A  >  body text

socket - JAVA 如何绑定localAddress

socket.connect(localAddress,localPort,remoteAddress,remotePort)

程序接口没有提供本地ip的绑定,修改源码太麻烦,有其他的方式吗?

伊谢尔伦伊谢尔伦2720 days ago575

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 14:49:41

    . . . . .
    The first method in the api is

    void    bind(SocketAddress bindpoint)
    Binds the socket to a local address.
    

    reply
    0
  • Cancelreply