Click here to Skip to main content
15,891,184 members
Home / Discussions / C#
   

C#

 
GeneralRe: watching process and the data they access Pin
tjawed9-Jun-04 18:31
tjawed9-Jun-04 18:31 
GeneralSaving image as JPEG - best possible quality Pin
michalJ9-Jun-04 11:44
michalJ9-Jun-04 11:44 
GeneralRe: Saving image as JPEG - best possible quality Pin
Dave Kreskowiak9-Jun-04 12:07
mveDave Kreskowiak9-Jun-04 12:07 
GeneralRe: Saving image as JPEG - best possible quality Pin
michalJ9-Jun-04 12:13
michalJ9-Jun-04 12:13 
GeneralRe: Saving image as JPEG - best possible quality Pin
Heath Stewart10-Jun-04 3:18
protectorHeath Stewart10-Jun-04 3:18 
GeneralRe: Saving image as JPEG - best possible quality Pin
michalJ11-Jun-04 2:45
michalJ11-Jun-04 2:45 
Generalsockets Pin
surgeproof9-Jun-04 10:30
surgeproof9-Jun-04 10:30 
GeneralRe: sockets Pin
Heath Stewart9-Jun-04 10:48
protectorHeath Stewart9-Jun-04 10:48 
There are several good ones here - use the ratings to see what people think is good.

As far as the protocol, that is defined entirely by you. Sockets are a simple connection between, well, sockets. That's it. More than likely, you'll want to use a TcpClient if you want to use TCP/IP for the connection protocol. What comes across the wire is defined by you, however.

Tons of protocols including HTTP, SMTP, FTP, etc. all use TCP/IP, but the protocol - the messages sent back and forth - is unique to each (though some common approaches exist, such as headers vs. body). In fact, someone earlier today simply asked about "telnet". Telnet is really just a simple TCP socket connection with know particular protocol.

A good way to handle this is to connect using a TcpClient and getting a NetworkStream by calling TcpClient.GetStream. Instantiate a StreamWriter and StreamReader on that stream with an agreed-upon encoding (like ASCII, UTF8, Unicode, etc.). Send and receive commands.

A good protocol will define errors codes that typically prefix a response message, making it quick and simple for you to determine if a command passed or failed.

For good examples of such protocols, I recommend you search http://www.ietf.org/rfc[^] for RFCs describing TCP protocols like SMTP, HTTP (pretty easy one), FTP, etc. I would recommend DICT (http://www.ietf.org/rfc/rfc2229.txt[^]), which I'm currently wrapping (slowly, with low priority). It's a simple protocol and gives you a pretty good idea of a good protocol design.

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: sockets Pin
GISnet9-Jun-04 10:51
GISnet9-Jun-04 10:51 
GeneralRe: sockets Pin
eggie59-Jun-04 19:05
eggie59-Jun-04 19:05 
GeneralRe: sockets Pin
surgeproof10-Jun-04 5:27
surgeproof10-Jun-04 5:27 
Generalserial port Pin
surgeproof9-Jun-04 10:29
surgeproof9-Jun-04 10:29 
GeneralRe: serial port Pin
Dave Kreskowiak9-Jun-04 11:59
mveDave Kreskowiak9-Jun-04 11:59 
GeneralRe: serial port Pin
quilkin10-Jun-04 5:21
quilkin10-Jun-04 5:21 
GeneralRe: serial port Pin
surgeproof10-Jun-04 5:29
surgeproof10-Jun-04 5:29 
GeneralUnhandled Exceptions Pin
Flack9-Jun-04 9:54
Flack9-Jun-04 9:54 
GeneralRe: Unhandled Exceptions Pin
Heath Stewart9-Jun-04 10:35
protectorHeath Stewart9-Jun-04 10:35 
GeneralMDI Child focus problem when button is disabled Pin
rlacatus9-Jun-04 9:13
rlacatus9-Jun-04 9:13 
GeneralRe: MDI Child focus problem when button is disabled Pin
link_799-Jun-04 9:26
link_799-Jun-04 9:26 
GeneralRe: MDI Child focus problem when button is disabled Pin
rlacatus9-Jun-04 11:19
rlacatus9-Jun-04 11:19 
GeneralWM_NCLBUTTONUP Pin
Guinness4Strength9-Jun-04 9:08
Guinness4Strength9-Jun-04 9:08 
GeneralRe: WM_NCLBUTTONUP Pin
Dave Kreskowiak9-Jun-04 9:49
mveDave Kreskowiak9-Jun-04 9:49 
GeneralRe: WM_NCLBUTTONUP Pin
Guinness4Strength9-Jun-04 11:04
Guinness4Strength9-Jun-04 11:04 
GeneralRe: WM_NCLBUTTONUP Pin
Dave Kreskowiak9-Jun-04 11:51
mveDave Kreskowiak9-Jun-04 11:51 
GeneralColumnChanging event on Dataset Pin
C#Coder679-Jun-04 7:50
C#Coder679-Jun-04 7:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.