![]() |
| | #1 |
| Registered User Join Date: Sep 2004
Posts: 78
| Sending 2 things simultaniously to same client. I would really appreciate any help I can get because I don't see any solution at all. |
| antex is offline | |
| | #2 |
| CSharpener Join Date: Oct 2006
Posts: 5,332
| You can wrap your messages in some internal protocol ((MesType,MesLen,MesBody)) and parse these buffers on the receiver side applying actions according to MesType
__________________ If I have eight hours for cutting wood, I spend six sharpening my axe. |
| vart is online now | |
| | #3 |
| Registered User Join Date: Sep 2004
Posts: 78
| Ok thanks. Is it a bad idea to let the first or first few bytes received from each call identify the type, or is that good enough for most purposes? But what if not all info gets extracted in one call, due to some connection problem or some kind of buffer problem, then the next piece of information won't be the identification bytes. How do I solve this? I really don't understand internal socket buffers or whatever they are called. Last edited by antex; 03-26-2007 at 05:36 AM. |
| antex is offline | |
| | #4 |
| CSharpener Join Date: Oct 2006
Posts: 5,332
| Define some pattern for message start and message end (called start marker and end marker) in my sample it was "((" and "))" check for these markers before you start parsing the rest and after you finished parsing if markers don't match - start scanning the stream till you find the start marker... It you use TCP and not UDP you should not have problems with loosing data or receiveing unordered data...
__________________ If I have eight hours for cutting wood, I spend six sharpening my axe. |
| vart is online now | |
| | #5 |
| Registered User Join Date: Sep 2004
Posts: 78
| Thank you very very much! |
| antex is offline | |
| | #6 | |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,768
| Quote:
| |
| brewbuck is offline | |
| | #7 |
| CSharpener Join Date: Oct 2006
Posts: 5,332
| BTW - I think that is what Messagenger ICQ etc do, You can check the number of open ports on your comp when you start simple conversation in Messager, and compare it to the number of open ports when the file transfer starts... 1 port should be added to the list
__________________ If I have eight hours for cutting wood, I spend six sharpening my axe. |
| vart is online now | |
| | #8 |
| Registered User Join Date: Sep 2004
Posts: 78
| Well, I didn't think about that at all, but that seem to be a good option and far easier to program too. Thank you both for your replies! I really appreciate you help! |
| antex is offline | |
| | #9 |
| Malum in se Join Date: Apr 2007
Posts: 3,188
| You could try sending the text as OOB data, which is handled seperately from the normal data stream. |
| abachler is offline | |
| | #10 |
| Senior software engineer Join Date: Mar 2007 Location: Portland, OR
Posts: 5,768
| |
| brewbuck is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Web server authentication using C client program by sending user name and password | vikass | C Programming | 2 | 07-24-2008 06:05 AM |
| server client problem | rudeboy | Networking/Device Communication | 5 | 05-17-2008 12:41 AM |
| sending binaries files between server and client | nacho4d | C Programming | 12 | 01-31-2008 01:54 AM |
| Sending messages with few fields between client and server? | nkn | C Programming | 2 | 11-23-2007 02:10 AM |
| Server Client Messaging Program | X PaYnE X | Networking/Device Communication | 3 | 01-04-2004 05:20 PM |