network-programming

send and receive request via sms instead of http

♀尐吖头ヾ 提交于 2020-01-25 18:06:06
问题 in my android application I want to send requests to server via sms if there was no internet connection or network. I am changing the Volley library code. http request is synchronous, when you send the request, thread waits until the response or error get received from server, but when you send sms, thread continue to work and doesn't wait to get the response sms so I am forced to use Callback functions(listeners). is there any better approach. is it good idea to use wait and notify to make

sctp_bindx (Solaris sctp library) always return “Invalid argument”

纵饮孤独 提交于 2020-01-25 12:37:07
问题 I am writing a SCTP test program in Solaris OS, and use Solaris native SCTP stack. The program likes this: if ((fd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP)) < 0) { perror("socket"); } addr.sin_family = AF_INET; addr.sin_port = htons(9004); addr.sin_addr.s_addr = inet_addr("192.168.23.117"); if (sctp_bindx(fd, (struct sockaddr*)&addr, sizeof(struct sockaddr_in), SCTP_BINDX_ADD_ADDR) < 0) { perror("bind"); } When running the program, it always return error:"Invalid argument". I have used

Error : “Transport endpoint is already connected”

大城市里の小女人 提交于 2020-01-24 18:46:30
问题 I am trying to develop a small chat server with C. For a simple chat server, ( Transport endpoint ) === ( socket ) ? Do i have to use one socket per client, or can I reuse a socket for multiple clients ? If so, how ? Is there a standard way of doing this ? Any good references available ? Can i get to see some sample implementations ? I have to use gcc compiler and c language for this assignment. 回答1: You need one socket/client and no, you cannot reuse sockets. If you have to handle multiple

Error : “Transport endpoint is already connected”

泄露秘密 提交于 2020-01-24 18:46:25
问题 I am trying to develop a small chat server with C. For a simple chat server, ( Transport endpoint ) === ( socket ) ? Do i have to use one socket per client, or can I reuse a socket for multiple clients ? If so, how ? Is there a standard way of doing this ? Any good references available ? Can i get to see some sample implementations ? I have to use gcc compiler and c language for this assignment. 回答1: You need one socket/client and no, you cannot reuse sockets. If you have to handle multiple

C# byte streams through TCP

无人久伴 提交于 2020-01-24 08:55:31
问题 I'm a Jr. Engineer hoping to seek some advice from all of the experienced people in here in regards to how to approach this. I've been assigned a project to create a server/client application that does byte streaming through TCP. Our company deals with 2-way radios with GPS with a dispatch software and we would like to make a server/client application out of that. Currently the dispatch software can be hooked up to a central base station where a user has to be, but we want to make this

C# byte streams through TCP

半腔热情 提交于 2020-01-24 08:55:25
问题 I'm a Jr. Engineer hoping to seek some advice from all of the experienced people in here in regards to how to approach this. I've been assigned a project to create a server/client application that does byte streaming through TCP. Our company deals with 2-way radios with GPS with a dispatch software and we would like to make a server/client application out of that. Currently the dispatch software can be hooked up to a central base station where a user has to be, but we want to make this

How to format the HTTP response

此生再无相见时 提交于 2020-01-23 02:03:25
问题 I have written a socket program in C. I used this program as a chat server/client using TCP. I tried to change the chat server to use it as a HTTP server by changing the port to 80. I referred to the HTTP request/response format in http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Example_session , and made my program to reply with sample response. I tried the url http://127.0.0.1/ in browser. My program read the request and replied with response. At first, I used google-chrome. Chrome

Does setting TCP_NODELAY affect the behaviour of both ends of the socket?

南楼画角 提交于 2020-01-22 19:33:17
问题 I've always assumed that Nagle's algorithm affected the socket in both directions, and that setting TCP_NODELAY somehow informed the remote end also to switch off Nagle. Is that right, or does setting TCP_NODELAY only affect the behaviour of the end that calls it? 回答1: TCP_NODELAY affect sending TCP segments only on the host that sets this option on its socket. That is, the peer's sending algorithm is not affected. 来源: https://stackoverflow.com/questions/8226512/does-setting-tcp-nodelay

What is the effect of setting a linux socket - high priority?

大城市里の小女人 提交于 2020-01-22 18:56:27
问题 From the linux socket manpage: SO_PRIORITY Set the protocol-defined priority for all packets to be sent on this socket. Linux uses this value to order the networking queues: packets with a higher priority may be processed first depending on the selected device queueing discipline. And this is set using: int optval=7 // valid values are in the range [1,7] // 1- low priority, 7 - high priority setsockopt(socket, SOL_SOCKET, SO_PRIORITY, &optval, optlen) And say, the process has: a. 10 low

Use multiple network interfaces in an app

微笑、不失礼 提交于 2020-01-22 17:33:05
问题 I wrote an app that is triggering a Sony qx smartphone attachable camera over wifi. However I need to transfer the images off the phone over another local network in real time. Since the wifi card is being used for qx connection I need to be able to use ethernet over usb for transferring images off the phone. Http requests will be used to trigger the camera and send the images off the phone. Is it possible in one android app on a phone with two network interfaces setup to specify for certain