network-programming

Android appending additional headers

元气小坏坏 提交于 2019-12-24 05:53:30
问题 When receiving a response from a volley request, the following headers are appended: X-Android-Received-Millis:1395544235409 X-Android-Response-Source:NETWORK 200 X-Android-Sent-Millis:1395544235363 According to Android Network Monitor tool, the above headers contribute to the data usage by the app and I was wondering if there's a way to prevent them from being appended to the response header? Thanks 来源: https://stackoverflow.com/questions/40306887/android-appending-additional-headers

Monitoring outgoing internet traffic

依然范特西╮ 提交于 2019-12-24 04:43:08
问题 Is there a way to monitoring internet traffic programatically? I would like to log the pages users are visiting on the Internet. Can this be achieved with .NET code, is there a 3rd party .NET component that could be used to retrieved data. Information about Internet traffic must be stored to a database so I cannot use a plugin or something for IE. We are also looking to include this code into our existing product so we cannot use a 3rd party product that cannot be redistributed. It would be

How can i get IP Address of my 3G modem?

爱⌒轻易说出口 提交于 2019-12-24 02:23:32
问题 My GPRS modem has got a sim card. it can connect Web. Web service give it a ip number. i need it. like that: http://www.your-ip-address.com/ How can i do that C#? 回答1: You can get a list of your IP addresses via DNS using the following code: var name = Dns.GetHostName(); var entry = Dns.GetHostEntry(name); foreach (var address in entry.AddressList) { Console.WriteLine(address); } If you want the IP address as a property of the hardware, you can use the System.Management.ManagementClass with

Determine the state of a TCP socket

不打扰是莪最后的温柔 提交于 2019-12-24 02:07:20
问题 I'm starting to learn about how to implement in C++ a TCP server/client (on Windows and Linux). At this moment, I'm implementing the server (and testing with the telnet as client). The server application is sending and recieving data like a charm.. (I will implement the client after understand all the server side). But I need to find a programmatic (C++ or O.S API) way to query the TCP socket state (ESTABLISHED, FIN_WAIT_2, CLOSE_WAIT, etc..) without use the write()/recv() to handle the error

How do I read a UDP connection until a timeout is reached?

十年热恋 提交于 2019-12-24 01:47:27
问题 I need to read UDP traffic until a timeout is reached. I can do this by calling SetDeadline on the UDPConn and looping until I get an I/O timeout error, but this seems hack-ish (flow control based on error conditions). The following code snippet seems more correct, but does not terminate. In production, this would obviously be executed in a goroutine; it's written as a main function for simplicity's sake. package main import ( "fmt" "time" ) func main() { for { select { case <-time.After(time

How to have Expect script output to file

[亡魂溺海] 提交于 2019-12-24 01:12:46
问题 I need to gather some statistics from a network switch and would like to use an expect script to output the data to a file. I would like to run this script as a cron job and have the data appended to the file when it is run. Following is the working code I have so far, I just do not know how to get the output to a file. Any help is greatly appreciated. #!/bin/bash #get mac-address count /usr/bin/expect -f -<<EOD spawn ssh user@192.168.1.100 sleep 2 #Catch the password prompt and send supplied

Python selenium: WinError 10053 - host is shutting connection down

偶尔善良 提交于 2019-12-23 21:25:23
问题 I started messing around with Python networking using selenium on Firefox. Unfortunately, I keep getting " ConnectionAbortedError : [WinError 10053] An established connection was aborted by the software in your host machine". However, this only happens when running some commands, and it only happens the first time I run them. If execute the command a second time right after that, it works. (See below for a minimal example.) I found this question, but being a networking newbie I'm having a

VB 6 Checking if a file on the network exists takes too long

限于喜欢 提交于 2019-12-23 19:53:24
问题 The following code: If FileExists(XCustPath + "XCust.dat") Then XCustRun End If and this code: Public Function FileExists(ByVal Fname As String) As Boolean Dim lRetVal As Long Dim OfSt As OFSTRUCT lRetVal = OpenFile(Fname, OfSt, OF_EXIST) If lRetVal <> HFILE_ERROR Then FileExists = True Else FileExists = False End If End Function XCustPath points to a mapped network location with the file XCust.dat inside it. But on the line: lRetVal = OpenFile(Fname, OfSt, OF_EXIST) It takes forever and

how to create a vpn software

空扰寡人 提交于 2019-12-23 18:32:36
问题 I want to create an application which creates a VPN between some endpoints, something like hamachi and i do not have a starting point. I haven't found any resource to explain how to create such a network application.I want to use c# because i have some experience with it. I really need some help, anything that can put me on the right way. Thanks. 回答1: There are a number of distinct elements of VPN software that you'll have to figure out: What technology/standard will your program use to

Sending the array of arbitrary length through a socket. Endianness

試著忘記壹切 提交于 2019-12-23 17:50:13
问题 I'm fighting with socket programming now and I've encountered a problem, which I don't know how to solve in a portable way. The task is simple : I need to send the array of 16 bytes over the network, receive it in a client application and parse it. I know, there are functions like htonl, htons and so one to use with uint16 and uint32. But what should I do with the chunks of data greater than that? Thank you. 回答1: You say an array of 16 bytes. That doesn't really help. Endianness only matters