packet

core audio: how can one packet = one byte when clearly one packet = 4 bytes

烂漫一生 提交于 2019-11-29 11:55:20
I was going over core audio conversion services in the Learning Core Audio and I was struck by this example in their sample code : while(1) { // wrap the destination buffer in an AudioBufferList AudioBufferList convertedData; convertedData.mNumberBuffers = 1; convertedData.mBuffers[0].mNumberChannels = mySettings->outputFormat.mChannelsPerFrame; convertedData.mBuffers[0].mDataByteSize = outputBufferSize; convertedData.mBuffers[0].mData = outputBuffer; UInt32 frameCount = packetsPerBuffer; // read from the extaudiofile CheckResult(ExtAudioFileRead(mySettings->inputFile, &frameCount,

com.mysql.jdbc.PacketTooBigException

三世轮回 提交于 2019-11-29 03:29:18
I am storing images in MYSQL. I have table as CREATE TABLE myTable (id INT, myImage BLOB); When I am trying to insert 4.7MB file, I am getting exception as com.mysql.jdbc.PacketTooBigException: Packet for query is too large (4996552 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable. I believe this is related to image size only. Is there any other variable type that I can use? Update 1 As per older SO question, I also tried with MEDIUMBLOB but still I am getting same error. Adding Image to a database in Java Update 2 At the start of the project, I

Get TCP Flags with Scapy

泪湿孤枕 提交于 2019-11-29 01:46:17
I'm parsing a PCAP file and I need to extract TCP flags (SYN, ACK, PSH, URG, ...). I'm using the packet['TCP'].flags value to obtain all the flags at once. pkts = PcapReader(infile) for p in pkts: F = bin(p['TCP'].flags) print F, bin(F), p.summary() # manual flags extraction from F Is there a way to obtain a single TCP flag without manually extract it from packet['TCP'].flags value? Normally, the usual way to handle FLAGS is with a bitmap and bitwise operators. If your Packet class doesn't have specific method to test for flags, the best thing you can do IMHO is to: FIN = 0x01 SYN = 0x02 RST =

Python Twisted proxy - how to intercept packets

送分小仙女□ 提交于 2019-11-28 23:22:24
问题 I'm trying to print out the body of a HTTP response using Python. Here is my code sofar: from twisted.web import proxy, http from twisted.internet import reactor from twisted.python import log import sys log.startLogging(sys.stdout) class ProxyFactory(http.HTTPFactory): protocol=proxy.Proxy reactor.listenTCP(8080, ProxyFactory()) reactor.run() When I connect my browser to localhost:8080, I can see that all my requests are being directed through the Python proxy running locally. But how do I 1

Compression algorithm for JSON encoded packets?

倖福魔咒の 提交于 2019-11-28 19:36:23
What would be the best compression algorithm to use to compress packets before sending them over the wire? The packets are encoded using JSON. Would LZW be a good one for this or is there something better? I think two questions will affect your answer: 1) How well can you predict the composition of the data without knowing what will happen on any particular run of the program? For instance, if your packets look like this: { "vector": { "latitude": 16, "longitude": 18, "altitude": 20 }, "vector": { "latitude": -8, "longitude": 13, "altitude": -5 }, [... et cetera ...] } -- then you would

Parsing WiFi Packets (libpcap)

允我心安 提交于 2019-11-28 18:53:42
I've been working on a way to have an OpenWRT router log WiFi probe requests to a MySQL db (it stores MAC address and RSSI info for each probe request packet along with other, router-specific data). After researching libpcap quite a bit, I've been able to cobble together a basic little program that simply sniffs packets on a monitor interface (mon0) using a filter expression ('wlan subtype probe-req') and then prints out the raw packets in hex. With the info that's available online on libpcap this part was fairly straightforward. Now here's where I'm stuck: How do I parse the WiFi packet to

JavaScript WebSockets with UDP?

妖精的绣舞 提交于 2019-11-28 16:56:40
I'm writing a JavaScript Application that has to receive a huge amount of data from other users. It is not important if some of this data gets lost. Is there some way of using JavaScript WebSockets with UDP instead of TCP? No, it's not possible to have UDP communication within JavaScript. Sorry. It sounds like what you're waiting for is WebRTC which is working it's way through the standards process. WebSockets, as other people have pointed out, run over TCP as a result of initiating with an HTTP Upgrade. kanaka The WebSockets protocol is over TCP only as currently defined. You could do UDP

Does TCP send a SYN/ACK on every packet or only on the first connection?

我们两清 提交于 2019-11-28 16:21:14
I have a TCP server that listens for an incoming client, then sends it one packet of data every second. I was wondering, does the SYN/ACK packet only get sent on initial connection, so it looks like this: <client connect> SYN ACK DATA DATA DATA <client disconnect> Or does it get sent with every packet, like this? <client connect> SYN ACK DATA SYN ACK DATA SYN ACK DATA <client disconnect> Also, if it's the first case, are there any benefits of UDP over TCP if you just keep the connection open over a long period of time? It's kinda like: +-------------------------------------------------------+

sending packets over serial comms java

我是研究僧i 提交于 2019-11-28 11:28:39
问题 I'm writing a java application that communicates with an external device over a serial port. I think I can connect to the device & send/receive data ok (I don't have access to the device at the moment..I'm using an emulator) I just need some advice on how I should format the data I'm sending. The spec says it should be sent in byte format..So if I have something like the following packet to send AA|0D|07|09|0A|0B|03|01|02|03|04|CSM|CSM is this the type of thing I should be doing outputStream

checksum udp calculation python

﹥>﹥吖頭↗ 提交于 2019-11-28 09:30:19
I'd like to calculate the checksum of an UDP header packet I want to send: packetosend = """60 00 00 00 00 24 3a 40 20 02 c0 a8 01 50 00 01 00 00 00 00 00 00 09 38 20 02 c0 a8 01 50 00 01 00 00 00 00 00 00 09 6f""" so I need to join this utf-16 (not a problem) and calculate the checksum of this specific packet. How can I do that? Thanks! EDIT: Yes it's an IPv6 header for an ICMPv6 packet, anyways what I would like to know is the formula, and how it works. I'll give another example with an ICMP ping echo (v4) packet: packet = """ 08 00 d1 15 76 0c 00 07 bf d3 55 4a ad b5 03 00 // "d1 15" is the