IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1822.21 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-06-15
Pages: < Prev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Next >
[14:28]<sdnffdxdlld>wb damieng-work
[14:29]<dzdyzzz-wjzc>lo
[14:30]<fyfuym-syfggag>smippy
[14:31]<sdnffdxdlld>hey Liquid-Silence
[14:33]<grvgrvya>does anyone have any experience with the System.Net.IPAdress class?
[14:33]<grvgrvya>+d
[14:33]<sdnffdxdlld>what are you trying to do with it?
[14:33]<grvgrvya>well im parsing a DCC SEND message which sends the IP address as a ULong
[14:34]<sdnffdxdlld>yeah
[14:34]<grvgrvya>when i convert that to a long and pass it to the constructor it creates the IPAddress fine
[14:35]<grvgrvya>then when i call ToString() it comes out in reverse order
[14:35]<dzdyzzz-wjzc>PAddress.NetworkToHostOrder()
[14:35]<grvgrvya>yep
[14:35]<grvgrvya>tried that
[14:35]<grvgrvya>but i get an ArgumentOutOfRange exception when calling the constructor
[14:36]<grvgrvya>which is why im confused
[14:36]<dzdyzzz-wjzc>you say it's sending a ulong?
[14:36]<dzdyzzz-wjzc>because a ulong is 64-bit
[14:36]<grvgrvya>well the ascii representation of one
[14:36]<grvgrvya>yes
[14:37]<grvgrvya>one sec ill pastebin that bit of code
[14:37]<dzdyzzz-wjzc>a.a.a.a where a is 8-bits. 8 * 4 = 32 bits.
[14:39]<grvgrvya>ok
[14:39]<dzdyzzz-wjzc>so i'm not sure what dcc is sending you. does the spec say?
[14:39]<dzdyzzz-wjzc>brb
[14:39]<grvgrvya>http://pastebin.com/710509
[14:40]<grvgrvya>as i said the ascii representation of a ulong in host byte order
[14:40]<grvgrvya>well thats what its supposed to be
[14:41]<grvgrvya>The address and port should be sent as ascii representations of the
[14:41]<grvgrvya>decimal integer formed by converting the values to host byte order
[14:41]<grvgrvya>and treating them as an unsigned long and unsigned short respectively.
[14:41]<sdnffdxdlld>bbiab guys
[14:41]<grvgrvya>thats the official spec
[14:42]<dyguw>A name for my method that converts millimeter to 1/100 of an inch?
[14:46]<grvgrvya>as i said when i dont call NetworkToHostOrder its creates the correct IP address fine, but in reverse order (ie. 232.178.152.82 as opposed to 82.152.178.232) so why doesnt the Byte order reversal work?
[14:49]<mjzymygo>Natnatic...
[14:49]<mjzymygo> return (long) (((IPAddress.HostToNetworkOrder((int) host) & 0xffffffff) << 0x20) | (IPAddress.HostToNetworkOrder((int) (host >> 0x20)) & 0xffffffff));
[14:49]<mjzymygo>is what HostToNewWorkOrder does.
[14:50]<mjzymygo>it swaps the MSB and LSB of the bytes you push into it
[14:52]<mjzymygo>with a ulong thats ok, but with a long thats not so ok, because is the highest MSB is set to 1, then it the number is treated on long's/int's etc as a minus value
[14:52]<mjzymygo>this might be what your getting argument out of range
[14:53]<mjzymygo>inside the IPAddress contructor:
[14:53]<mjzymygo> if ((newAddress < 0) || (newAddress > 0xffffffff))
[14:53]<mjzymygo> {
[14:53]<mjzymygo> throw new ArgumentOutOfRangeException("newAddress");
[14:53]<mjzymygo> }
[14:53]<mrfjrrg>You can't have newAddress < 0 if you can have newAddress <= 0xffffffff
[14:53]<mrfjrrg>unless you have a 64 bit machine
[15:03]<kdzdgdjvgnv>Moridin8, i posted on the forums and goddamn my post was very very long
[15:04]<kdzdgdjvgnv>you should see it :P
[15:06]<grvgrvya>oh nice... thankyou very much
[15:07]<dyguw>I still need a name for my converter function :)
[15:07]<dyguw>s/function/method(
[15:10]<kdzdgdjvgnv>im going to bed ttyl guys
[15:12]<grvgrvya>yep youre completely right... after reversing the byte order im getting a negative number
[15:12]<mjzymygo>NATnatic... yeh. thought so.
[15:13]<mjzymygo>;)
[15:14]<grvgrvya>so should i call HostToNetworkOrder before converting to a long then?
[15:14]<mjzymygo>I would.
[15:14]<mjzymygo>but either way, if the value in the long is greater that 0xffffffff then it will die.
[15:14]<mjzymygo>I think your missing a concept somewhere
[15:15]<mjzymygo>but I couldn't tell you where because I haven't really messed with what you are.
[15:15]<grvgrvya>ok
[15:15]<mrfjrrg>It's not possible to have a value greater than 0xffffffff on a 32 bit machine
[15:16]<mjzymygo>djLogon: dude. yes you can
[15:16]<grvgrvya>well i cant pass the ULong to HostToNetworkOrder because theres no overload accepting a ULong
[15:16]<mrfjrrg>No you can't
[15:16]<mrfjrrg>And certainly not in a long
[15:17]<mjzymygo>djLogan. your talking out your bum
[15:17]<mjzymygo>play around with .NET long type...
[15:17]<mjzymygo>it's a 64bit type
[15:18]<zgzzcygnv>with a language like Python you can operate on numbers of nearly infinite length
[15:18]<mrfjrrg>long is a 64 bit even on a 32 bit system?
[15:18]<zgzzcygnv>djlogan ..........................................
[15:19]<mjzymygo>djlogan. in .NET yes
[15:20]<mrfjrrg>ok
[15:22]<grvgrvya>bah... im still confused as to what i should do... i cant switch the sign bit because i still get an argument out of range exception
[15:22]<grvgrvya>there must be someway of reversing the order of a ULong before converting it to a Long
[15:23]<mjzymygo>any examples of codeproject?
[15:23]<grvgrvya>sorry?
[15:23]<mjzymygo>on codeproject... sorry
[15:23]<zgzzcygnv>NATnatic try the BitConverter class
[15:23]<grvgrvya>hmmm... hadnt thought og that
[15:23]<grvgrvya>of*
[15:23]<zgzzcygnv>neither did i untill right then :P
[15:28]<mjzymygo>NATnatic... whatever you do, the MSB 32 bits need to be set to off. if not, then the value in the ulong will be greater tht 0xffffffff
[15:28]<mjzymygo>tht = than
[15:28]<grvgrvya>yeh i got that... thakns
[15:29]<mjzymygo>=)
[15:42]<y-gz`sfnnl>What is a good way to do events
[15:43]<mjzymygo>meh?
[15:43]<y-gz>should I have internal methods in the same class to raise them
[15:43]<y-gz>or should I just raise the public events from other classes where I have a reference to the event
[15:43]<mjzymygo>events should only be raised by their owner classes
[15:44]<mjzymygo>M$ suggest 'OnThingy' naming convention I think...
[15:44]<y-gz>right, cause I have a class which has the raising methods are protected
[15:44]<y-gz>so I will just make soms special methods which will be internal and so :)
[15:50]<drdyrrrq>raise the events in protected virtual OnMyEvent







