What is the graceful way of moving your data to byte[]'s to be sent over the wire? In C++, I'd do something like this struct SomeDataHeader { AnEnum SomeDescriptiveFlag DWORD dwDataLength } void SendThis(SOCKET &rS, LPCTSTR szData) { SomeDataHeader h; h.SomeDescriptiveFlag = SDH_RANDOMSTUFF; h.dwDataLength = lstrlen(szData) + 1; BYTE *pbData = new BYTE[sizeof(h) + h.dwDataLength]; memcpy(pbData, h, sizeof(h)); memcpy(&pbData[sizeof(h)], szData, h.dwDataLength); Send(rS, pbData, sizeof(h) + h.dwDataLength); } (Note that this code is pretty sloppy/probably not right, but you get my idea) What I'm trying to do is send arbitrary data over the line; What's the best way to do this?
NorthWoodsman
Posts
-
Copying data to bytes for sockets -
Setting Master VolumeHow do you set the master volume for sound devices? There appears to be no simple way to do this; Every time I try to find something, I end up being bogged 10 miles deep in random WINMM functions that, in my opinion, should've been depreciated about 3 versions ago. Mind you, I don't want to control the WAVE volume, I want the "What you Hear" volume, or in other words, what is set when you left-click the Sound tray icon.
-
Client-side scripts with ASP.NETSo I'm trying to add script my ASP.NET objects using JScript on the client side (Just dumb stuff like resizing images, etc), and I have this code:
<!-- function Form_onResize() { Image1.width = 2 } -->
This code, when executed, shows a "Image1 not defined" in both Mozilla Firebird and IE6. Seeing the source code downloaded by the browser shows that they are indeed still named. Also, when I add the "name" tag to ASP:image, it underlines it, like it doesn't understand the tag.
-
Question about UTF8 EncodingHow do I take an arbitrary string and UTF8 encode it using System.Text.Encoding.UTF8? I found out how to write strings and how to convert byte data, but not how to convert strings. You'd think this would be easier; maybe I'm missing something. (I'm using C# by the way).