Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

header files

Name: Anonymous 2009-10-11 22:06

So I'm basically making a mini version of IRC, with one server that handles connections from a lot of clients.  Then I decided I would pretty much make my own protocol, with a header attached to every operation.  Every operation, sending text, sending a file, creating/joining a room, would have a header attached to it with details like receiver and sender IDs, time stamp, etc. 

So this sounds nice and all in theory, but I'm absolutely at a loss at how to code this thing.  How would I join the header object to the data object?  concat?  Except I don't know wtf that is.  After a client receives something, how would it separate the header from the data?

And making the header... if I create a new header, decide that its sub-operation is going to be "sending," how do I send it to the file class, have the file class create the sub-op packet, and return it?  It all makes sense conceptually but writing the code is hitting me like a brick wall.

Name: Anonymous 2009-10-11 22:20

>>5

C#

I already have an RFC-like document, I just don't know how to write it in code...basically it goes a little something like this:

Header:
Main operation ID - byte
Sub operation ID - byte
Receiver ID - string
sender ID - string
time stamp - Date
size of sub op - int

Main operations would be File, Text, Room, Connect, etc
Sub ops would be for example, file send, room create, etc.

The send() method would look like

send(){
    header h = new header
    if subop == 2
        send to file class, creates file subop packet, returns
    p = combine(h, data) //concat?
}
send p


But the problem is I don't know how to write this in actual code

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List