network-programming

Detect any connected network

风流意气都作罢 提交于 2020-01-10 09:13:10
问题 How can I detect if any network adapter is connected? I can only find examples on using NSReachability to detect an internet connection, but I want to detect even a non-internet network connection. Getting the IP-adress on eth0 should work? I'm working on Mac only. 回答1: Getting a List of All IP Addresses in Apple's Technical Note TN1145 mentions 3 methods for getting the status of the network interfaces: System Configuration Framework Open Transport API BSD sockets System Configuration

JS Function to send data over network?

北城余情 提交于 2020-01-10 06:16:25
问题 I have been experimenting with JavaScript lately and was wondering if there was a way to send data from one computer to another on the same network. If there is, you do I use it? 回答1: Sure there is, but you need a server for that. You cannot connect directly two computers' browsers over a network: Computer A ---+ | SERVER | Computer B ---+ The server's task will then be that of passing messages from one client to the other. You'll need PHP or C# ( e.G. ASP.NET) for that. This topic is very

Reading from a TcpStream with Read::read_to_string hangs until the connection is closed by the remote end

孤街醉人 提交于 2020-01-10 04:49:04
问题 I'm attempting to implement the Haskell IRC bot tutorial in Rust and am having some difficulty reading what the server sends me after connecting. What seems to happen is that I connect, read ~5 KB from the server, and then roughly 240 seconds later everything is dumped at once instead of being read line-by-line. The connection is closed by a ping timeout, which should happen eventually, since I don't yet have a ping-pong function to reply with. Here's what I have so far: use std::io::{Read,

Determine the IP Address of a Printer in C#

跟風遠走 提交于 2020-01-09 10:51:33
问题 I would like to determine the IP address of a printer, using C# (.NET 2.0). I have only the printer share name as set up on the Windows OS, in the format \\PC Name\Printer Name . The printer is a network printer, and has a different IP address to the PC. Does anyone have any pointers? Thanks in advance for your help. Regards, Andy. 回答1: Check this question: How to get Printer Info in C#.NET?. I think that you have to get the property PortName from the WMI properties. 回答2: Just adding an

Determine the IP Address of a Printer in C#

喜欢而已 提交于 2020-01-09 10:51:03
问题 I would like to determine the IP address of a printer, using C# (.NET 2.0). I have only the printer share name as set up on the Windows OS, in the format \\PC Name\Printer Name . The printer is a network printer, and has a different IP address to the PC. Does anyone have any pointers? Thanks in advance for your help. Regards, Andy. 回答1: Check this question: How to get Printer Info in C#.NET?. I think that you have to get the property PortName from the WMI properties. 回答2: Just adding an

How many socket connections can a web server handle?

最后都变了- 提交于 2020-01-08 18:16:26
问题 Say if I was to get shared, virtual or dedicated hosting, I read somewhere a server/machine can only handle 64,000 TCP connections at one time, is this true? How many could any type of hosting handle regardless of bandwidth? I'm assuming HTTP works over TCP. Would this mean only 64,000 users could connect to the website, and if I wanted to serve more I'd have to move to a web farm? 回答1: In short: You should be able to achieve in the order of millions of simultaneous active TCP connections and

How to know if given IPV6 address belongs to the same subnet as local machine

帅比萌擦擦* 提交于 2020-01-07 07:45:10
问题 Currenly I have a c function that takes a ip address and subnetmask and checks if given ipv4 is private/public. It does by following logic to matchsubnet: (local ipv4 address && local subnetmask) == (given ipv4 && given subnetmask) What logic can be written for ipv6? I can write a function to receive an ip and subnet prefix. Can i get local subnet prefix? 回答1: I order to determine if two hosts are on the same subnet take both their addresses and prefix lengths (subnet masks). If the prefix

Connecting from .NET to Asterisk

被刻印的时光 ゝ 提交于 2020-01-06 08:26:32
问题 I am trying to connect from a .NET application to the Asterisk server, but the connection is not established. I am using the following code to connect to Asterisk: Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse("192.168.0.35"), 5038); clientSocket.Connect(serverEndPoint); and I get the following error: A connection attempt failed because the connected party did not properly respond

Connecting from .NET to Asterisk

放肆的年华 提交于 2020-01-06 08:26:10
问题 I am trying to connect from a .NET application to the Asterisk server, but the connection is not established. I am using the following code to connect to Asterisk: Socket clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse("192.168.0.35"), 5038); clientSocket.Connect(serverEndPoint); and I get the following error: A connection attempt failed because the connected party did not properly respond

Kubernetes service not working as expected with kafka

做~自己de王妃 提交于 2020-01-06 06:07:38
问题 I'm trying to setup a zookeeper and kafka as separate Kubernetes deployments/pods in a shared namespace. I've bootstraped a local K8s 1.8 with Calico via kubeadm on my Ubuntu sandbox... For the Zookeeper, I'm using the image zookeeper:3.4 from hub.docker.com and I created a Kubernetes deployment and service, where I expose ports: 2181 2888 3888. Service name is zookeeper and I assume I should be able to use it by this hostname from the pods in the namespace. For the Kafka 1.0, I've created my