Skip to main content

Pipe Dream

Right well, it's not really a pipe dream... not even close, but it was a cool name anyways because I've learned how to use named pipes! Woohoo! I'm sure none of you know what those even are. Since using sockets is unbelieveably hard (for me at least, haven't found enough good information yet) in programming I turned towards another network aware system. They are called named pipes which programs access (and provide) them using the style of \\.\pipe\pipename or \\computer\pipe\pipname. Kind of neat isn't it? Once I got down transfering some basic text down the pipe, it stepped it up one notch... without using any tutorals this time - just pure knowledge and frustration. I have taught myelf how to transfer structs between programs. A struct is variable that groups together other variables (simple definiton). If you want a more comprehensive definition just visit this wiki article. What's really neat is it lets me pass just one variable that holds others inside... and I can also write functions inside of the structs to manipulate their data (not usually necessary). I guess something notable is that a struct can hold many different datatypes inside of them. Here is an example:

typedef struct tagSample {
    int nValue;
    TCHAR szString[100];
    DWORD dwFlags;
    BOOL bReadyToSend;
} SAMPLESTRUCT, *LPSAMPLESTRUCT;

In that example the struct SAMPLESTRUCT defined four different data types: a number (int), a string (TCHAR), another number (DWORD), and a true/false (BOOL). To other functions that accept a struct (usually will accept anything) I can just pass a samplestruct. This makes life easier since I can connect and send once rather than connecting and sending four different things. My only worry right now is that I don't know if named pipes will work on {li,u}nix machines.

I have to admit I am proud of myself for figuring this out. It only took a few hours of compiling and fixing the bugs.