Which method of the socket class returns the local port to which the scoket object binds

Updated on technology 2024-03-13
9 answers
  1. Anonymous users2024-02-06

    host, int port)

    Create a socket and connect it to the specified port number at the specified address.

  2. Anonymous users2024-02-05

    You are talking about the client's local IP, stringip=;;

  3. Anonymous users2024-02-04

    You can specify the port number directly when you build.

  4. Anonymous users2024-02-03

    serversocket()

    Create an unbound server socket.

    serversocket(int port)

    Create a server socket that is bound to a specific port.

    serversocket(int port, int backlog)

    Create a server socket with the specified backlog and bind it to the specified local port number.

    serversocket(int port, int backlog, inetaddress bindaddr)

    Create a server with the specified port, listening backlog, and the local IP address you want to bind to.

  5. Anonymous users2024-02-02

    1. All bind is the function called by the server, and the binding is the IP of the server, assuming that the server has multiple NICs, that is, there will be multiple IPs, at this time, we can choose to bind one of the IPs with bind, then the server only receives the data of a port on the IP.

    If bind is bound to InAddr Any, it means that all the data sent to the server, regardless of which NIC or IP address the data received, will be processed by the server process.

  6. Anonymous users2024-02-01

    The so-called bind refers to binding the local acceptance port.

    IP addresses are specified to distinguish between multi-IP hosts.

    Bind is a function called by the server, binding the server's IP, assuming that the server has multiple NICs, that is, there will be multiple IPs, at this time we can choose to bind one of the IPs with bind, then the server only receives data from a certain port on the IP.

    If bind is bound to InAddr Any, it means that all the data sent to the server, regardless of which NIC or IP address the data received, will be processed by the server process.

  7. Anonymous users2024-01-31

    inaddr any is actually 0; This means that the kernel will elect a temporary IP address based on the process.

    It's the same as if you specified an IP address. It's just that, with Inaddr Any, this IP address is elected by the kernel itself.

  8. Anonymous users2024-01-30

    socket type. serversocket creates a port to listen, and if a client connects to this port, the accpt method will return a socket object to form a communication channel with the client for the first message.

  9. Anonymous users2024-01-29

    server**.

    serversocket ss = new serversocket(8888);

    client**.

    socket s = new socket("", 8888);

    The port number of the client should be based on the port number of the server, and then pass the port number as a parameter when creating the socket object to create the object.

Related questions
8 answers2024-03-13

With a background in computer + economics and management, it will be easy to find a job in the future. What you learn is very empty, but you need the name of the major, not what you learn. You can't learn the things you manage, you can only practice and understand them by yourself. >>>More

29 answers2024-03-13

new, call the answer method under this function, and the arguments required in it are v, whb, b >>>More

5 answers2024-03-13

The employment prospects of instrument majors are good. >>>More

7 answers2024-03-13

Hello. Ship Niang mobile game recommends the fleet collection of this game to you,This game is a very classic ship Niang mobile game,This gameplay is diverse,The playability is very high,You can**Experience the game。 >>>More

5 answers2024-03-13

Hello, Accountant Zheng Diantong Online School This question: >>>More