|
1
|
Other Software / Developer's Corner / Re: Announcing with UDP in C# - Punching above my weight
|
on: May 03, 2011, 10:42:17 AM
|
Sorry if I get a little Captain Obvious here, but are you sure the request packet is being replicated exactly? It's the same as the WireShark capture, but past that I can't be 100%. I've certainly given up on this, so don't spend any more time on it. Once the announce works I've got to query the box for the channels all while programming on a subnet that doesn't actually have the boxes on it. This project is where an attitude of 'fail quickly and adapt' is working well. The C# application to use the Wireshark data works well enough for how little it would be used. Thanks all Graham
|
|
|
|
|
2
|
Other Software / Developer's Corner / Re: Announcing with UDP in C# - Punching above my weight
|
on: May 03, 2011, 05:16:44 AM
|
Thanks Jazper, You code confirms what I've previously found. It seems quite easy and reliable to get the router you are connected to to respond to these types of broadcasts but the more unreliable and inconsistent IPTV systems seem to lock up the .Receive commands. In the end I've been using Wireshark and monitoring the responses of a propriety IPTV multicast program. I then export the filtered Wireshark output into a C# application to get all the channels. Formatted for C# with the GeSHI Syntax Highlighter [ copy or print] // Please excuse the fact that I found out it was called 'Wireshark' about half way through and then // couldn't be bothered fixing the function names private void btnOpenWireShackFile_Click(object sender, EventArgs e) { MessageBox.Show("Remember to select the Wireshark \"K12 Text File\" that you have saved with " + "the filter 'sap.flags' (no apostrophes) and save \"Packet Range: Displayed\" and \"All packets\"", "Instructions", MessageBoxButtons.OK, MessageBoxIcon.Information); btnSave.Enabled = false; openWireshackTxtFile.Title = "Choose wireshark txt file"; openWireshackTxtFile.Filter = "TXT Files|*.txt"; if (openWireshackTxtFile.ShowDialog(this) == DialogResult.OK) { strWireSharkFileLocation = openWireshackTxtFile.FileName; replaceBigTextBox(""); replaceM3UTextBox(""); Thread threadReadHex = new Thread (readHexAndOutputASCII ); threadReadHex.IsBackground = true; threadReadHex.Start(); } } private void readHexAndOutputASCII() { if (strWireSharkFileLocation == "VOID") { return; } try { strWireSharkFile = File.ReadAllLines(strWireSharkFileLocation); } catch { MessageBox.Show("Failed to open Wireshack file", "Fatal error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } replaceM3UTextBox("#EXTM3U\r\n"); int i = 1; int j = 0; foreach (string line in strWireSharkFile) { if (line.Length > 2 && line.Substring(0, 2) == "|0") { string[] characters = line.Split('|'); string completeLine = ""; foreach (string hex in characters) { if (hex.Length == 2) { try { int n = Convert.ToInt32(hex, 16); if (n >= 32 && n < 255) { char c = (char)n; completeLine += c.ToString(); } else if (n == 10) { completeLine += "|"; } } catch { // Do we need to do anything here? } } } addToBigTextBox(completeLine.Replace("|", "\r\n") + "\r\r\n"); string[] partLine = completeLine.Split('|'); foreach (string data in partLine) { if (data.Length > 3 && data.Substring(0, 2) == "s=") { string channelName = data.Substring(2, data.Length - 2); addToM3UTextBox("#EXTINF:" + i + "," + channelName + "\r\n"); } if (data.Length > 3 && data.Substring(0, 2) == "c=") { string nospacedata = data.Replace(" ", ""); string[] splitip = nospacedata.Split('/'); string ip = splitip[0].Substring(7, splitip[0].Length - 7); addToM3UTextBox("udp://" + ip + ":5000" + "\r\n"); } } decimal deProgressBar = (((decimal)j + 1) / (decimal)strWireSharkFile.Length) * 100; intProgressBar = (int)Math.Ceiling(deProgressBar); changeProgressBar(); i++; } j++; } intProgressBar = 100; changeProgressBar(); }
|
|
|
|
|
4
|
Other Software / Developer's Corner / Re: Announcing with UDP in C# - Punching above my weight
|
on: April 27, 2011, 10:37:13 AM
|
LAN. I'm working my way through the example code I linked above and was wondering if anyone else had seen any code like it. I suppose it really was a shot in the dark. This is the kind of code I'm after Formatted for C# with the GeSHI Syntax Highlighter [ copy or print] public static bool Discover() { Socket s = new Socket (AddressFamily .InterNetwork, SocketType .Dgram, ProtocolType .Udp); s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); string req = "M-SEARCH * HTTP/1.1\r\n" + "HOST: 239.255.255.250:1900\r\n" + "ST:urn:schemas-upnp-org:device:InternetGatewayDevice:1\r\n" + "MAN:\"ssdp:discover\"\r\n" + "MX:3\r\n\r\n"; byte[] data = Encoding.ASCII.GetBytes(req); IPEndPoint ipe = new IPEndPoint (IPAddress .Broadcast, 1900); byte[] buffer = new byte[0x1000 ]; DateTime start = DateTime.Now; Console.WriteLine("Starting do while < timeout"); do { s.SendTo(data, ipe); s.SendTo(data, ipe); s.SendTo(data, ipe); int length = 0; do { length = s.Receive(buffer); string resp = Encoding.ASCII.GetString(buffer, 0, length).ToLower(); Console.WriteLine(resp); } while (length > 0); } while (start.Subtract(DateTime.Now) < _timeout); return false; } }
|
|
|
|
|
5
|
Other Software / Developer's Corner / Announcing with UDP in C# - Punching above my weight
|
on: April 27, 2011, 09:38:33 AM
|
Hi all, I've got a multicast IPTV system where I work and a piece of software, which no longer works in Windows 7, discovers what channels are available using SSDP. I was hoping to write a short console application that would annouce itself and then wait for replies. My programming skills lend themselves to manipulating online examples to do what I want, but I'm having trouble finding any example code for this type of thing, this being the only example I can find - http://www.codeproject.co...versal.aspx?display=Print . I was wondering if anyone knew of anything else out there?
|
|
|
|
|
7
|
Other Software / Developer's Corner / onsubmit doesn't work in IE
|
on: March 14, 2011, 05:09:14 PM
|
Hi all, I'm getting confused by a problem. Everything works fine in Firefox, but in IE I can't get a form to submit correctly with the enter key. I have this function Formatted for Javascript with the GeSHI Syntax Highlighter [ copy or print] function enter() { if (step == 7) { return true; } else { next(); return false; } }
and this line of code Formatted for HTML with the GeSHI Syntax Highlighter [ copy or print] <form id="form" name="form" method="post" action="upload.php" onsubmit="return enter();">
But enter() never seems to load until you get to a real submit button. I've put the entire code here - http://www.unics.co.uk/onsubmit/Does anyone know what might be the issue?
|
|
|
|
|
10
|
Other Software / Developer's Corner / Re: Is it easy to send a request to http://IP?password and make something happen?
|
on: August 09, 2010, 07:48:07 AM
|
|
Apologies for the late reply.
I don't actually need to download anything, just to get the computer to display the image. So the computer should be listening for a command, and when it gets it it will display an image on the screen of the computer.
It's one of those things that seems hard to say and harder to actually get working. I was just wondering if one of the geniuses here had seen something around.
Thanks Graham
|
|
|
|
|
11
|
Other Software / Developer's Corner / Is it easy to send a request to http://IP?password and make something happen?
|
on: August 03, 2010, 11:42:28 AM
|
|
Hi clever people.
I work in a University. In our lecture theatres we have a touch screen that makes all the equipment work, a computer and a projector (as well as other bits we can ignore).
We've been asked to make a button on the touchscreen that makes a picture appear on the projector. There are some expensive ways around this but the cheapest would be the following
Press button on touch panel > Touch panel sends a GET to the computer > The computer is listening for this GET and when it recieves it, it shows a picture.
Is this easy to do? Or does it involve running web servers on computers. I.e. can I write a simple c# program that says 'wait for this command on port 1337'?
|
|
|
|
|
12
|
Other Software / Developer's Corner / Re: AHK Newbie: SendInput to a particular process
|
on: May 10, 2010, 10:26:38 AM
|
Thanks, that's the perfect command. Do you see why this doesn't work? [ copy or print] #2:: Run, C:\Windows\System32\notepad.exe, , , notepad1pid Run, C:\Windows\System32\notepad.exe, , , notepad2pid Sleep, 500 ControlSend, notepad1pid, Hello Notepad 1 ControlSend, notepad2pid, Hello Notepad 2 return
|
|
|
|
|
13
|
Other Software / Developer's Corner / AHK Newbie: SendInput to a particular process
|
on: May 10, 2010, 09:47:31 AM
|
|
Hi all, I've just written a very simple AHK script to load up VNC and then log into a PC, open IE, go to a website and login. The trouble is that if I click off the window it all breaks.
Is there a way of sending keys to a particular process (and if so how to find the process)? The process is started by AHK in the script.
Thanks
Graham
|
|
|
|
|
16
|
Main Area and Open Discussion / General Software Discussion / Default audio settings
|
on: March 25, 2010, 02:18:00 PM
|
|
Does anyone know of a program that will remember a audio setting (default playback / recording device, levels, mute settings, etc) and will automatically set them each time it loads?
I'm also looking for a levels meter that can sit in the system tray or desktop. Can anyone help me out?
|
|
|
|
|
21
|
DonationCoder.com Software / Screenshot Captor / No disc in Drive D
|
on: March 01, 2010, 05:36:23 AM
|
|
Hi Mouser, I upgraded my work computer to Windows 7 last week and I've just installed SC. The trouble is after I install (to C:\Program Files (x86)\ScreenshotCaptor) I get 4-5 error messages appear saying
"There is no disk in the drive. Please insert a disk into drive D:"
D is my CD drive. I've uninstalled and re-installed. My shortcut points to "C:\Program Files (x86)\ScreenshotCaptor\ScreenshotCaptor.exe", the program occasionally says 'no timers availble' and I cannot use it.
Can you think what the problem is?
|
|
|
|
|
22
|
Main Area and Open Discussion / General Software Discussion / Re: Monster Cables- The World should know!
|
on: February 03, 2010, 04:28:50 AM
|
Even that article isn't too reassuring. Budget 10% of your system money for a cable? So if I buy a $4,000 HDTV I'm supposed to budget $400 for the HDMI cable? I'd rather stick to MonoPrice. A $5 HDMI cable suits me just fine. Unless I can get it for less. (c; Richer sounds always used to quote 10% for cabling but that was because of all the composite and speaker cables that have to go between everything. 10% between two devices seems a bit excessive.
|
|
|
|
|
24
|
Other Software / Found Deals and Discounts / Bioshock 2 with free Bioshock
|
on: January 22, 2010, 01:57:58 AM
|
|
(I don't know what this deal is like for non UK)
Steam seem to have (or have ingeniously designed) a mistake on the pre-order of BioShock 2. Their full price is £39.99 and currently have a pre-order offer of 10% off making it £25.99. Now my maths isn't great but I think that 40 - (10% of 40 = 4) = 36. So take them up on the offer while it is there.
During the pre-order they are giving away BioShock 1 for pc. I already have it so if someone wants it for a few donation credits (which I've run out of but want to give to skwire) than let me know.
Graham
|
|
|
|
|
25
|
Special User Sections / N.A.N.Y. 2010 / Re: NANY 2010 Release: Anuran
|
on: January 20, 2010, 08:17:25 AM
|
|
You may know about this but the program is causing the 'return' key to be a carriage return before it is a 'ok' command.
This doesn't cause too many problems normally, just an extra line in the AnVu software. However if you remember the last entry it means that the cursor starts underneath the sentence the next time it appears. It also means that if you remove something from the beginning of the sentence you end up with blank lines
(2010-01-20 @ 01:10:49 PM) Lunch (2010-01-20 @ 01:41:14 PM) Tickets and VHS digitisation (2010-01-20 @ 02:11:18 PM) VHS digitisation
I think this is the following
(2010-01-20 @ 01:41:14 PM) Tickets and VHS digitisation [blank line added by fault in return key] [blank line added by AnVu at the end of message] [blank line added by AnVu at the start of the next message] (2010-01-20 @ 02:11:18 PM) [blank line as I removed 'Tickets and' and pressed Enter ] VHS digitisation
|
|
|
|
|