 Julia 中文文档242 CHAPTER 22. 网络和流 22.5 一个简单的 TCP 示例 让我们直接进入一个 TCP 套接字相关的简单示例。此功能位于名为 Sockets 的标准库中。让我们先 创建一个简单的服务器: julia> using Sockets julia> @async begin server = listen(2000) while true sock = accept(server) @0x00007fd31dc11ae0 对于那些熟悉 Unix 套接字 API 的人,这些方法名称会让人感觉很熟悉,可是它们的用法比原始的 Unix 套接字 API 要简单些。在本例中,首次调用 listen 会创建一个服务器,等待传入指定端口(2000)的 连接。 julia> listen(2000) # 监听(IPv4 下的)localhost:2000 Sockets.TCPServer(active) julia> 时,我们连接到刚刚创建的服务器。与此同时,accept 函数返回到新创建的套接字的服务 器端连接,并打印「Hello World」来表明连接成功。 Julia 的强大优势在于,即使 I/O 实际上是异步发生的,API 也以同步方式暴露,我们不必担心回调, 甚至不必确保服务器能够运行。在我们调用 connect 时,当前任务等待建立连接,并在这之后才继 续执行。在此暂停中,服务器任务恢复执行(因为现在0 码力 | 1238 页 | 4.59 MB | 1 年前3 Julia 中文文档242 CHAPTER 22. 网络和流 22.5 一个简单的 TCP 示例 让我们直接进入一个 TCP 套接字相关的简单示例。此功能位于名为 Sockets 的标准库中。让我们先 创建一个简单的服务器: julia> using Sockets julia> @async begin server = listen(2000) while true sock = accept(server) @0x00007fd31dc11ae0 对于那些熟悉 Unix 套接字 API 的人,这些方法名称会让人感觉很熟悉,可是它们的用法比原始的 Unix 套接字 API 要简单些。在本例中,首次调用 listen 会创建一个服务器,等待传入指定端口(2000)的 连接。 julia> listen(2000) # 监听(IPv4 下的)localhost:2000 Sockets.TCPServer(active) julia> 时,我们连接到刚刚创建的服务器。与此同时,accept 函数返回到新创建的套接字的服务 器端连接,并打印「Hello World」来表明连接成功。 Julia 的强大优势在于,即使 I/O 实际上是异步发生的,API 也以同步方式暴露,我们不必担心回调, 甚至不必确保服务器能够运行。在我们调用 connect 时,当前任务等待建立连接,并在这之后才继 续执行。在此暂停中,服务器任务恢复执行(因为现在0 码力 | 1238 页 | 4.59 MB | 1 年前3
 Julia 1.11.4100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2007 页 | 6.73 MB | 3 月前3 Julia 1.11.4100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2007 页 | 6.73 MB | 3 月前3
 Julia 1.11.5 Documentation100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2007 页 | 6.73 MB | 3 月前3 Julia 1.11.5 Documentation100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2007 页 | 6.73 MB | 3 月前3
 Julia 1.11.6 Release Notes100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2007 页 | 6.73 MB | 3 月前3 Julia 1.11.6 Release Notes100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2007 页 | 6.73 MB | 3 月前3
 Julia 1.12.0 DEV Documentationdocumentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function 1113 49.1 Example In the example below we use a scoped value to implement a permission check in a web-application. After determining the permissions of the request, a new dynamic scope is entered and0 码力 | 2009 页 | 6.72 MB | 1 年前3 Julia 1.12.0 DEV Documentationdocumentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function 1113 49.1 Example In the example below we use a scoped value to implement a permission check in a web-application. After determining the permissions of the request, a new dynamic scope is entered and0 码力 | 2009 页 | 6.72 MB | 1 年前3
 Julia 1.11.0 DEV Documentationdocumentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function 1107 49.1 Example In the example below we use a scoped value to implement a permission check in a web-application. After determining the permissions of the request, a new dynamic scope is entered and0 码力 | 2007 页 | 6.71 MB | 1 年前3 Julia 1.11.0 DEV Documentationdocumentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function 1107 49.1 Example In the example below we use a scoped value to implement a permission check in a web-application. After determining the permissions of the request, a new dynamic scope is entered and0 码力 | 2007 页 | 6.71 MB | 1 年前3
 Julia 1.11.0 beta1 Documentationdocumentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function end 49.1 Example In the example below we use a scoped value to implement a permission check in a web-application. After determining the permissions of the request, a new dynamic scope is entered and0 码力 | 1997 页 | 6.68 MB | 1 年前3 Julia 1.11.0 beta1 Documentationdocumentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function end 49.1 Example In the example below we use a scoped value to implement a permission check in a web-application. After determining the permissions of the request, a new dynamic scope is entered and0 码力 | 1997 页 | 6.68 MB | 1 年前3
 julia 1.13.0 DEV100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2058 页 | 7.45 MB | 3 月前3 julia 1.13.0 DEV100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2058 页 | 7.45 MB | 3 月前3
 Julia 1.12.0 RC1100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2057 页 | 7.44 MB | 3 月前3 Julia 1.12.0 RC1100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2057 页 | 7.44 MB | 3 月前3
 Julia 1.12.0 Beta4100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2057 页 | 7.44 MB | 3 月前3 Julia 1.12.0 Beta4100%|████████████████████████████████| Time: 0:00:00 Main binary filename not available. Serving web UI on http://localhost:62261 "alloc-profile.pb.gz" Then you can view the profile by navigating to documentation. – Interfaces for Julia packages are typically described using docstrings, README.md, static web pages, ... • Some developers choose not to export all symbols required to use their package/module Julia is running in a JavaScript VM (JSVM), including e.g. a WebAssembly JavaScript embedding in a web browser. Julia 1.2 This function requires at least Julia 1.2. source Base.Sys.loadavg – Function0 码力 | 2057 页 | 7.44 MB | 3 月前3
共 87 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9













