buffer

How to receive and store binary data from server in iOS?

大兔子大兔子 提交于 2019-12-11 18:04:12
问题 I am working on an application for the iPhone (iOS 5). What I have to do is create a map by using binary data that I reveive from a server. If the server has bytes available, I read them into a buffer: uint8_t[1024]. Then I parse through this data and create objects (e.g. a path that contains points with longitude and latitude) from it, but those objects are often larger than my buffer. On the simulator this is not a huge problem, because I have enough memory to store them into mutable arrays

Buffer gets overwritten

不羁岁月 提交于 2019-12-11 17:37:02
问题 I'm facing this issue on an ESP8266 (Arduino like board), but this problem is regarding c/c++, so I'm asking this here. I have not that much experience with native languages like c/c++ and I'm facing a strange issue, which drives me crazy. So I'm using an Wemos D1 mini (ESP8266) which uses a class calles ConfigManager to read a configuration file from eeprom. The config file is formatted as json, so I'm using ArduinoJson to parse the content. I have declared a StaticJsonBuffer and pointer to

Monitoring Network Packets Using Network Kernal Extension

大憨熊 提交于 2019-12-11 17:15:29
问题 I am building NKE(Network Kernal Extension) for filtering and modifying the packets on the fly. myipfilter_output_redirect callback gives mbuf_t pointer and based on the researched knowledge it has every information related to the network call. I want to read the html from this mbuf_t and inject one css/html into it. how can I achieve it? static errno_t myipfilter_output(void* cookie, mbuf_t* data, ipf_pktopts_t options) { if (data) log_ip_packet(data, kMyFiltDirOut); return 0; } static errno

Pyinstaller flush input

北城余情 提交于 2019-12-11 16:44:37
问题 I've a python program which works fine within the Pycharm environment. I tried compiling it with Pyinstalle to a onefile executable. It works fine, but I see no output till I select it. I actually casually discovered this using ctrl+A. I tried adding flush=True to print, but with no results. The program starts with a simple print and even that first one won't show up. Any ideas? EDIT: It also seems like that this "buffering" stops execution, but I'm not completely sure of that. 回答1: Using sys

Java - “no buffer space available” socket error cause?

痴心易碎 提交于 2019-12-11 16:38:33
问题 I'm writing a networking program in Java. I use ServerSocket and Socket objects to send and receive messages using TCP. My program runs fine if run for a short time however if I run it for a longer time, I get the following error: java.net.SocketException: No buffer space available (maximum connections reached?): connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at

C++: Read files in 4096B steps [duplicate]

丶灬走出姿态 提交于 2019-12-11 16:35:01
问题 This question already has answers here : Reading and writing binary file (7 answers) Closed 5 years ago . I want to write a ftp class with sockets, textfiles work pretty well to upload so far, but then I wanted to upload a bigger file, a movie, and it didn't work. The first 4096B are read well, but then it reads just nothing more. Maybe i'am using the wrong functions, please help my with my code. Here's my read function: bool CStream::Read (string * _OutString, unsigned int _iStartPos,

Behind the scenes of Java's BufferedInputStream

梦想的初衷 提交于 2019-12-11 16:24:13
问题 To start with, I understand the concept of buffering as a wrapper around, for instance, FileInuptStream to act as a temporary container for contents read(lets take read scenario) from an underlying stream, in this case - FileInputStream . Say, there are 100 bytes to read from a stream(file as a source). Without buffering, code( read method of BufferedInputStream ) has to make 100 reads(one byte at a time). With buffering, depending on buffer size, code makes <= 100 reads. Lets assume buffer

OS X Get highlighted text

会有一股神秘感。 提交于 2019-12-11 15:57:05
问题 I'm interested in writing a plugin for OS X to support multiple operations on highlighted text in the right click context menu. The operations are simple enough that I could write them by myself. I've looked at automator's "Copy to Clipboard" action, but it requires some text input first. The "Get contents of Clipboard" action will make my operations require the highlighted text to first be copied to the clipboard. So the question is simple: how do I access the system wide highlighted text

how to send long message using node smpp?

冷暖自知 提交于 2019-12-11 14:59:52
问题 exports.sendSMS = function (session, to, text, sourceAddress, jsonMessageHistoryIds, callback) { console.log('messege',text); session.submit_multi({ source_addr: sourceAddress, dest_address: to, short_message: text }, function (pdu) { console.log('submit_multi: ', pdu.command_status); console.log("PDU", pdu); if (pdu.command_status == 0) { // insert into sms smpp logs var values = { type: 'bulk', message: text, numbers: JSON.stringify(to) }; console.log(pdu.message_id); callback(null, pdu

PHP/Curl - Loop & POST buffer not clearing

偶尔善良 提交于 2019-12-11 12:42:34
问题 I'm using cUrl to POST to a web page (not local) and then return the html. I need to do this multiple times, so the cUrl code is in a while loop. Here's the weird thing: it works as expected the first time, but doesn't seem to clear the POST buffer everytime there after. (I do close_curl($ch). And all the data passed through POST is correct.) For instance, one of the text fields should be (and, the first time, is) pass "ANY". But the second time it is pass "ANY, ANY". Am I correct that this