raw

PHP Convert IPv6 to binary(/memory) representation

Title says it all. I already "did" this for IPv4; $ip = '127.0.0.1'; // example $ip = explode('.',$ip); if( count($ip) != 4 ) $ip = array(0,0,0,0); // wrong ip format, default to 0.0.0.0 return chr($ip[0]) . chr($ip[1]) . chr($ip[2]) . chr($ip[3]); I need to do the above for IPv6 as well. Reading through the IPv6 spec, (I admit I didn...

Receiving an entire UDP packet

I am programming a UDP proxy application for Windows in C++ that sends and receives UDP packets with Winsock. The problem is that I need to work with the ENTIRE packet, not just the data and UDP and/or IP header. I have tried raw sockets with IP_HDRINCL (might be misspelled), but it still chops off some information from the packet. Is th...

Winsock alternative (no, not WinPCAP)

Are there any viable alternatives to Winsock for C++? The reason I need of is because Winsock's raw sockets are not behaving properly (no, this is not fixable, don't waste your time asking) and WinPCAP can only monitor network traffic, not actually receive packets. I need something that can receive complete packets including any IP, UDP,...

Data trailing 0xFFD9 in a JPEG embedded in a camera RAW

I want to replace the JPG preview image in a my camera's RAW files with the camera's JPG (I shoot JPG + RAW). I'm using a Panasonic GH1, so the RAW format is RW2. After having finally figured how the RW2 file is organized, I noticed that exiftool can do exactly what I want. However, I noticed that the JPG preview image embedded in an RW...

how to convert 16-bit RGB Frame Buffer to a viewable format?

I'm working with someone else's code on a device which can put an image to /dev/fb/0 and show up on video out or send it over the network to a client application. I don't have access to the old source for the client app, but I know the following about the data: 720x480 16-bit RGB (I'm no sure if it's 5,5,5 or 5,6,5) RAW (no headers w...

Difference between pointer and smart pointer

Can you tell me what is wrong with this piece of code? I got asked this in an interview and I am not sure what's wrong with it tClass is a test class with a method printSomething that prints members of tClass. tClass * A = new tClass(); f(A); A->printSomething(); auto_ptr<tClass> * B = new tClass(); f(B); B-> printSomething(); or ...

Tuning table select SQL having a RAW column in Oracle 10g

Hi all, I have a table with several columns and a unique RAW column. I created an unique index on the RAW column. My query selects all columns from the table (6 million rows). when i see the cost of the query its too high (51K). and its still using INDEX FULL scan. The query do not have any filter conditions, its a plain select * from...

android text file resource problem

Hi , I have a problem with txt files in my raw folder (android project) Explanation: I am added a some txt files to a folder raw/eng and I need to get that files (read) in class I made some if branches and happens that some files I can reference but some not "R.raw.ejapan" cannot be resolved ??? This is screen shot of ...

How do I check if a sentence contains a certain word in Python and then perform an action?

Let's say that I ask a user for raw input and they said, "This is a message." If that raw input contained the word "message" it would perform an action after that. Could I see how this can be done? ...

can directsound play raw binary sound file

hi, my question is can directsound play raw binary sound file witout a wav. header the thing is i took a binary file encoded in U-law ive decoded(PCM) it and now i need to play it. it lacks a header so can a directsound play the decoded file. ...

Script or program to read RAW data

Ok, I had a usb flash drive which had data and was using FAT32 file table, till yesterday!! I had been using it only in Windows. Now when I plugin the usb flash drive, Windows XP reports the file system as RAW and trying to access the drive asks to format the drive. I desperately need to get some data out from there (the backup is a few...

How to determine start of data payload in TCP packet?

Hi, I'm writing program for monitoring FTP traffic using raw sockets. Now, I am able to determine start of data in TCP packet using this code: // char * packet; // struct * iphdr; // struct * tcphdr; // ... // check, whether sniffed ethernet frame contains IP and TCP char * data; data = (packet + sizeof (struct ethhdr) + sizeof (str...

Library function returns raw pointer and I want to use smart pointer

I have this situation where the library I use has many functions that return raw pointers to objects, how could I now use boost smart pointers in my program using this library and using smart pointers? The library is xerces-C++ and an example is getting the document iterator: boost::shared_ptr<DOMNodeIterator> itera = document->createN...