sockets

Create a socket for 4.0 bluetooth transmission

[亡魂溺海] 提交于 2021-02-07 17:02:53
问题 I'm developing an Android app than can transmit data to a 4.0 Bluetooth serial device. I'm guiding by LeGatt android sample project (http://developer.android.com/samples/BluetoothLeGatt/index.html). In this project, they connect to the device, but nothing about transmission data. For 2.0 bluetooth I can create a Socket, InputStream and OutputStream to transmit the data, something like this: protected BluetoothSocket mySocket = null; private InputStream MyInStream; private OutputStream

Golang net.Listen binds to port that's already in use

断了今生、忘了曾经 提交于 2021-02-07 14:37:40
问题 Port 8888 is already bound on my (OS X 10.13.5) system, by a process running inside a docker container: $ netstat -an | grep 8888 tcp6 0 0 ::1.8888 *.* LISTEN tcp4 0 0 *.8888 *.* LISTEN A python program which tries to bind to that port (using as close to the socket options of golang as I can manage), fails in the way I expect: import socket import fcntl import os def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) flag = fcntl.fcntl(sock.fileno(), fcntl.F_GETFL) fcntl.fcntl

Golang net.Listen binds to port that's already in use

为君一笑 提交于 2021-02-07 14:35:40
问题 Port 8888 is already bound on my (OS X 10.13.5) system, by a process running inside a docker container: $ netstat -an | grep 8888 tcp6 0 0 ::1.8888 *.* LISTEN tcp4 0 0 *.8888 *.* LISTEN A python program which tries to bind to that port (using as close to the socket options of golang as I can manage), fails in the way I expect: import socket import fcntl import os def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) flag = fcntl.fcntl(sock.fileno(), fcntl.F_GETFL) fcntl.fcntl

Golang net.Listen binds to port that's already in use

房东的猫 提交于 2021-02-07 14:35:28
问题 Port 8888 is already bound on my (OS X 10.13.5) system, by a process running inside a docker container: $ netstat -an | grep 8888 tcp6 0 0 ::1.8888 *.* LISTEN tcp4 0 0 *.8888 *.* LISTEN A python program which tries to bind to that port (using as close to the socket options of golang as I can manage), fails in the way I expect: import socket import fcntl import os def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) flag = fcntl.fcntl(sock.fileno(), fcntl.F_GETFL) fcntl.fcntl

Is transmitting a file over multiple sockets faster than just using one socket?

不问归期 提交于 2021-02-07 14:32:09
问题 In this old project (from 2002), It says that if you split a file into multiple chunks and then transmit each chunk using a different socket, it will arrive much faster than transmitting it as a whole using one socket. I also remember reading (many years ago) that some download manager also uses this technique. How accurate is this? 回答1: Given that a single TCP connection with large windows or small RTT can saturate any network link, I don't see what benefit you expect from multiple TCP

Is transmitting a file over multiple sockets faster than just using one socket?

百般思念 提交于 2021-02-07 14:31:13
问题 In this old project (from 2002), It says that if you split a file into multiple chunks and then transmit each chunk using a different socket, it will arrive much faster than transmitting it as a whole using one socket. I also remember reading (many years ago) that some download manager also uses this technique. How accurate is this? 回答1: Given that a single TCP connection with large windows or small RTT can saturate any network link, I don't see what benefit you expect from multiple TCP

First write to a remotely-closed socket does not trigger exception, can it? Java

杀马特。学长 韩版系。学妹 提交于 2021-02-07 14:20:20
问题 I have not been able to find a satisfying answer to this question anywhere. Could someone with an understanding of the internals please explain this? I wrote a simple client/server to demonstrate this issue. The server reads one line of text then closes the socket. The client writes one line of text, waits 10 seconds, then writes two more lines of text. The second write (after 10 seconds) fails but the first write always succeeds. Why can't the BufferedWriter throw an exception on the first

Canonical way to “broadcast” data to multiple processes in linux?

无人久伴 提交于 2021-02-07 14:14:12
问题 I've got an application that needs to send a stream of data from one process to multiple readers, each of which needs to see its own copy of the stream. This is reasonably high-rate (100MB/s is not uncommon), so I'd like to avoid duplication if possible. In my ideal world, linux would have named pipes that supported multiple readers, with a fast path for the common single-reader case. I'd like something that provides some measure of namespace isolation (eg: broadcasting on 127.0.0.1 is open

Socket.io works with localhost but not on Heroku server

与世无争的帅哥 提交于 2021-02-07 12:32:26
问题 I am currently trying to use socket.io and a node.js server to communicate with a Unity script. I have everything hooked up and working with localhost, but for some reason when I port it to my Heroku server it can't connect. I'm assuming it might have something to do with the URL's? I'm new to socket.io so any help would be appreciated. My node.js server: var express = require('express'); var app = express(); var expressWs = require('express-ws')(app); var path = require('path'); var server =

How to close (kill, release?) a socket, which is in FIN_WAIT_2 state?

我是研究僧i 提交于 2021-02-07 12:14:05
问题 I have a client application, which uses a unmanaged dll for communicating with a server. All network-related operations are perormed inside the unmanaged dll. After a number of operations with the server, the client is running out of TCP ports. If we check the state of netwotk using 'netstat -an', we get the following result: ... TCP 192.168.11.55:56048 192.168.10.28:5000 FIN_WAIT_2 TCP 192.168.11.55:56049 192.168.10.28:5000 FIN_WAIT_2 TCP 192.168.11.55:56050 192.168.10.28:5000 FIN_WAIT_2 TCP