network-programming

How to Resume file uploading process in Android?

无人久伴 提交于 2020-01-02 03:44:08
问题 I am uploading a file on server using this code, But I want such a functionality: if it stops due to lost a network or any other interruption during the process, then it shouldn't be start uploading from beginning at second time. response from server is also customizable. is it possible in android? what approach should I use to do this? please guide me. and if possible please suggest me any sample piece of code. Thanks! public String uploadFile(InputStream is) { HttpURLConnection conn; String

How to forward HTTPS traffic from a SOCKS proxy to HTTP proxy

醉酒当歌 提交于 2020-01-01 19:21:36
问题 I have written a SOCKS proxy which works with both HTTP and HTTPS traffic if chaining is turned off. If chaining is turned on and the forwarding host and port belong to a filtering HTTP proxy then only HTTP traffic can flow. HTTPS traffic does not flow and reports an SSL error. Note that the HTTP proxy does handle HTTPS traffic when the request is coming direct from the browser and not from the SOCKS server. As an example if I make a request to https://www.google.com the following occurs: 1)

Is there such a RTSP Ping?

我的梦境 提交于 2020-01-01 18:18:15
问题 I am currently working on a WinForm app to stream videos from IP camera using the RTSP protocol in C#. Everything worked fine. Part of the requirement for the app includes a function to check whether the IP camera is online or not. So I did a ping function using the System.Net.NetworkInformation.Ping class to ping the IP camera. Say if the RTSP url of the camera is as follows rtsp:// [CAMERA IP] :554/Master0-RTSP/1.0, I would only need to extract the [CAMERA IP] part and use the Ping class to

When I call WSASend(), will all the data be sent?

孤者浪人 提交于 2020-01-01 17:15:26
问题 When using IOCP, if I call WSASend() with let's say 2 KB of data. When I receive a completion notification, will this completion notification indicate that the entire 2 KB were sent, or there could be some bytes that were not sent? 回答1: Under normal circumstances, yes, your completion will receive notification that the entire 2 KB was sent, as long as the socket is using overlapped I/O. The only scenario where it may return less than the size of the data sent is when the connection is

what type of network programming is necessary in iPhone online multiplayer game?

你离开我真会死。 提交于 2020-01-01 12:32:09
问题 I am asking this question as a small part of my question series regarding game programming . Refer this question as the main one . Now suppose I want to develop a game on iphone - a simple online multiplayer board game. Suppose its a casino table. In the main question ChrisF has tell me of sort of Client - Server architecture for iphone online multiplayer game. I want to know what sort network programming I have to do for this type of application . What will be the responsibilities and

detect temporary ipv6 address crossplatform

醉酒当歌 提交于 2020-01-01 11:50:53
问题 I want to detect if an address is temporary ipv6 address, i using getifaddrs to get the list of addresses but don't know how to get that info from there. And if possible i want that to work for linux, osx, solaris and windows. I have seems that in Linux IFA_F_TEMPORARY is set in inet6_ifaddr->ifa_flags, but not sure if how can i get that from the ifaddrs returned by getifaddrs. Seems that on OSX i need octl with SIOCSIFINFO_FLAGS, and i have no idea about Solaris or Windows. has any body a

Get list of computers in a domain using .Net

大兔子大兔子 提交于 2020-01-01 11:48:24
问题 How to get list of computer names in a domain using C# ? 回答1: using System.DirectoryServices; public void PrintComputersInDomain (string domainName) { DirectoryEntry de = new DirectoryEntry ("LDAP://" + domainName); de.Children.SchemaFilter.Add ("computer"); foreach (DirectoryEntry c in de.Children) { Console.WriteLine (c.Name); } } from http://msmvps.com/blogs/siva/archive/2008/01/25/enumerating-computers-in-a-domain.aspx 回答2: If you are on a windows domain, you can run an LDAP query against

A socket operation was attempted to an unreachable host

陌路散爱 提交于 2020-01-01 09:55:24
问题 One customer reported this error at my WCF client connecting to our server service. "Message: A socket operation was attempted to an unreachable host Type : System.Net.Sockets.SocketException" From this link http://msdn.microsoft.com/en-us/library/ms740668%28v=vs.85%29.aspx i see: WSAEHOSTUNREACH 10065 No route to host. A socket operation was attempted to an unreachable host. See WSAENETUNREACH. WSAENETUNREACH 10051 Network is unreachable. A socket operation was attempted to an unreachable

Network byte order conversion with “char”

回眸只為那壹抹淺笑 提交于 2020-01-01 09:33:30
问题 I've always been taught that if an integer is larger than a char, you must solve the byte ordering problem. Usually, I'll just wrap it in the hton[l|s] and convert it back with ntoh[l|s]. But I'm confused why this doesn't apply to single byte characters. I'm sick of wondering why this is, and would love for a seasoned networks programmer to help me shed some light on why byte orderings only apply for multibyte integers. Ref: https://beej.us/guide/bgnet/html/multi/htonsman.html 回答1: What you

Input/Output Stream : End of Stream?

喜你入骨 提交于 2020-01-01 09:00:55
问题 I was always wondering: What is the end of a stream? In the javadoc of most readLine methods in the java.io package, you can read that "this returns null if the end of the stream is reached" - though I never actually got a null, as most streams (in the case of a network stream that I use most often) just block the program execution until something is written into the stream on the remote end Are there ways to enforce this acutal behavior happening in an actual non-exception throwing way? I am