Close
Close window
Close - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

Socket

Close

terminate an open TCP/IP connection

Calling Sequence

Close(sid)

Parameters

sid

-

valid open socket ID

Description

The procedure Close is used to close an open socket that was created by using either the Sockets[Open] or Sockets[Serve] routines in the Sockets package. This terminates an open connection on the socket and releases any resources used internally by the socket.

The argument sid identifies the socket to be closed. It must be a valid and open socket ID.

You should always close any sockets that you open as soon as you are done with them. Most systems have a hard limit on the number of open sockets that any one process may have at one time. The Sockets package itself imposes such a limit (in most cases, coincident with the limit imposed by the underlying operating system).

Closing a socket releases the resources it uses and enables new sockets to be created without overflowing the maximum limit. (On some systems, a socket is just a file, and so each open socket contributes also to the number of open files held by a process, which is also usually limited by the operating system.)

When Close is called, it attempts to shut down the connection, flushing any buffered data written to the socket. The remote endpoint of the connection is notified that no further data will be accepted at the local endpoint. Once the connection has been successfully shut down, Close returns the value true. In the event of an error condition, the value false is returned.

All open socket connections are shut down when the Sockets package itself is garbage collected by the system, or when the Maple process in which it is running terminates normally. Although it is guaranteed that this will eventually occur, there is no user level control over when it will happen, so Close must not be relied upon for normal termination of socket connections.

Examples

>

withSockets:

>

sidOpenlocalhost,echo

0

(1)
>

Closesid

true

(2)


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /