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.43 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-09-02
[20:14]<hallnzvan>which is the case, when i manually put a number instead of string.length
[20:14]<vufvuzn>they are a _stream_
[20:14]<hallnzvan>well, this stream is encoded with lengths
[20:14]<vufvuzn>no it isn't..
[20:15]<hallnzvan>ns.Write(Encoding.ASCII.GetBytes(TcpRawString), 0, 6); this works
[20:15]<vufvuzn>there's no functional difference between doing Write("foo"); Write("bar") and Write("foobar")
[20:15]<hallnzvan>ns.Write(Encoding.ASCII.GetBytes(TcpRawString), 0, TcpRawString.Length); this does not
[20:15]<vufvuzn>if you observe a difference, it's purely coincidental
[20:15]<vufvuzn>and forget about encoding stuff for a moment, Kog gave you a red herring because he misunderstood your problem
[20:16]<hallnzvan>well i am trying to keep up
[20:16]<kjr>vulture: sad panda
[20:16]<kjr>vulture: he should still be calling Length on the byte[]
[20:16]<pz2>is there any way to get Visual Studio to help me with parantheses?
[20:16]<vufvuzn>point is: you're dealing with a stream, there's no deliniation between characters in a stream, the only thing that's important is the order they are written in, not the "grouping"
[20:16]<kjr>and not on the string
[20:16]<pz2>like flash my match, or highlight the expression... or something?
[20:17]<rrrdjdtxyrr>Unless the reads and write interleave perfectly you will always run the risk of a read either a) reading nothing or b) reading 2 writes (or more)
[20:17]<vufvuzn>Kog: there's no reason for him to be dealing with bytes at all.. he could just write strings and pass the string length.. - if he's doing the encoding manually (which I see no reason for) then yes, he'd need to pass the length of the resulting array
[20:17]<kjr>vulture: well, that's where my "red herring" came from
[20:17]<hallnzvan>TcpRawString = "[1|10]" <- how do i calculate the bytes then
[20:17]<vufvuzn>Hoppertje: Don't calculate them, leave it to a StreamWriter to do for you
[20:17]<hallnzvan>hmm
[20:18]<kjr>vulture: but, readline and writeline are what I usually end up using
[20:18]<vufvuzn>(specify an encoding for the StreamWriter that matches the encoding used by your client's StreamReader if you want to be sure things will reach the other end in the correct form)
[20:18]<vufvuzn>Kog: sure, newline delimited protocols are common
[20:18]<hallnzvan>my book meantions like 10 lines about StreamReader and StreamWriter
[20:18]<kjr>vulture: even if I got his problem wrong, the advice is still valid ;)
[20:19]<vufvuzn>Hoppertje: time to find more information, like on MSDN - and Joel On Software has a good rant on basics of encoding that every developer should be aware of
[20:19]<hallnzvan>MSDN sucks for beginners
[20:19]<kjr>vulture: http://www.joelonsoftware.com/articles/Unicode.html ?
[20:20]<vufvuzn>probably
[20:20]<rfnwyt>helo
[20:20]<vufvuzn>Hoppertje: so.. find some way to delimit your protocol's packets - eg with newlines as Kog mentioned (assuming your data cannot contain such values)
[20:20]<rfnwyt>can a web Service class have a constructor that has a paramter
[20:21]<kjr>hm, time to go a-walkin downtown
[20:26]<rrrdjdtxyrr>does read on a network stream block if no data is found?
[20:29]<rrrdjdtxyrr>Is threading hard to do and would it be worthwhile pushing my networking code out into threads?
[20:29]<rrrdjdtxyrr>e.g. if the network is slow, my UI becomes unresponsive, would threading fix this?
[20:30]<vufvuzn>RandomThing: you shouldn't be doing IO from the UI thread, though whether or not this is the right time for you to try to explore how to do it correctly is another issue
[20:30]<vufvuzn>reads (and writes, for that matter) can block, but you should check the documentation for the methods you are calling to see what they will block for
[20:31]<rrrdjdtxyrr>what do you mean by 'the right time'?
[20:31]<vufvuzn>for example, the read operation you are using might only block waiting for at least one byte/char/whatever & not fill the entire array (might return how many bytes/chars/whatever were actually read) - in which case you might need to perform the looping/blocking manually
[20:32]<vufvuzn>I mean whether you're ready to try to grasp & implement all of that. Realise that in many cases doing things the "Right Way" requires more knowledge than can be acquired in one go - so as you learn you will be doing things weirdly/inefficiently/whatever (but hopefully not outright incorrectly)
[20:32]<rrrdjdtxyrr>k
[20:32]<rrrdjdtxyrr>threading was the right thought tho, right?
[20:34]<vufvuzn>yes, the operations should not be performed in the event processing thread - so they can be done in another thread which can post back (Invoke/InvokeBegin/etc) to the event processing thread when they need to interact with the UI
[20:35]<rrrdjdtxyrr>any good resources out there that cover the basics of threading?
[20:36]<vufvuzn>I haven't really looked into it for C# specifically.
[20:44]<hallnzvan>are TCP
[20:44]<hallnzvan>oops
[20:44]<hallnzvan>are TCP streamwriter, read in the system.io namespace?
[21:03]<rrrdjdtxyrr>Is it possible for me to make an object that internally stores a collection of data and access it using [] type syntax?
[21:05]<vufvuzn>RandomThing: called operator overloading, yes it's possible
[21:06]<rrrdjdtxyrr>OK... any pointers on how?
[21:08]<vufvuzn>msdn: operator overloading, perhaps
[21:08]<rrrdjdtxyrr>Yeah, ok... maybe I should have just searched rather than asking.
[21:08]<rrrdjdtxyrr>Sorry.
[21:27]<vuwyluwy>i'm reading through the C# docs and play around with #develop and it's really amazing. one thing i couldn't find out about yet is "[STAThread]". what's the meaning of it?
[21:31]<dbq>hello all :)
[21:31]<dbq>how do i make an rectangle (or line for that matter) in the toolbox ?
[21:31]<zjdrg22>2(tuxipuxi2): http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemstathreadattributeclasstopic.asp
[21:32]<zyjvnz>DB2 use the graphics class
[21:32]<dbq>rioter: isnt there some way to draw a simple static box in the toolbox ??
[21:32]<zyjvnz>i think its like Graphics.FillRectangle
[21:32]<vuwyluwy>romanbb, ah, thanks
[21:32]<dbq>again, i must use a class?
[21:33]<zyjvnz>um this is c#
[21:33]<zyjvnz>its a object oreinted language
[21:35]<dbq>rioter: do you understand what i'm asking ?
[21:35]<dbq>you know what is that toolbox thingy where you can add elements to a form ?
[21:35]<dbq>i'm asking if there is an element which is a line or seperator of sort..
[21:36]<dbq>wtf has "<rioter> its a object oreinted language" got to do with this...
[21:36]<zyjvnz>oh your talking in regards to the visual studio ui?
[21:36]<zyjvnz>well, asking if you have to use a class in a channel about a object oreinted language is kinda wierd
[21:37]<dbq>yeah...
[21:38]<dbq>rioter: maybe the word toolbox was misunderstood, i'm talking about the visual c# designer...
[21:38]<dbq>anybody know ?
[21:39]<cudjf>hi
[21:42]<dgndj>I have one of those DllImport declarations of something native... one of the parameters is "[Out] out object a" ... what does the [Out] part mean??
[21:50]<dbq>anybody knows ?
[21:50]<dbq>how do i make an rectangle (or line for that matter) in the designer toolbox ?
[21:51]<y-gz>you want a category ?
[21:54]<rrrdjdtxyrr>mnemo: it means that the function changes that value as part of it's routine and it's only used as an output value (as far as I know)
[21:54]<rrrdjdtxyrr>does that make sense?
[21:54]<dgndj>so the inner "out" means the function will write to that variable
[21:54]<dgndj>and
[21:55]<dgndj>what does the [Out] part mean?
[21:56]<dgndj>or is it like I must explicitly tell both the managed and unmanaged sides how the parameter is going to be handled?
[21:56]<dgndj>im still uncertain about the [Out] part unfortunately ;/
[21:56]<rrrdjdtxyrr>erm
[21:56]<rrrdjdtxyrr>not sure I can help there...
[21:57]<dgndj>;(
[21:57]<dgndj>thanks anyway
[21:57]<rrrdjdtxyrr>gimme a sec, I'll see if I can find out elsewhere...
[21:57]<rrrdjdtxyrr>(no promises here tho)
[21:59]<dbq>i-nZ: i want the element that does it ..
[21:59]<y-gz>it's probably an Attribute
[22:00]<dbq>you talking about my line thingy?
[22:00]<dgndj>i-nZ: aha good idea







