472,144 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,144 software developers and data experts.

socket programming using c#.net

hi,
this is srinivas here i am using socket programming to send data to a remote computer using clssocket with namespace system.net and it is working well, but when i am sending continuous data in a packet format to one more remote computers there i am facing the problem of mixing status
one packet format is #010211*
other is $010228&&&&1111*
using visual studio 2005 , oracle 10g
when continuously sending the packet data is been mixed
pls help me in solving the problem of mixing data
Feb 25 '08 #1
7 2377
Plater
7,872 Expert 4TB
UDP packets are not garunteed to arrive in any sort of order.
Use a TCP/IP connection (socketstream) if you want to garuntee data sent out arrives in the same order.
Feb 25 '08 #2
Hi Plater,
Thank u for u r response....
but i am using Tcp/ip connection and my server ip is 192.168.1.1, port no -8821
and client suppose 192.168.1.4 or 192.168.1.54 etc.....
but still whatever the packet i receive on server they get mixed on server side
how to resolve this problem............

Regards
srinivas
Feb 26 '08 #3
Plater
7,872 Expert 4TB
Uhh, I would say it is a problem in either how you are sending the data or how you are receiving the data, because they come in in the same order they go out.
Feb 26 '08 #4
hi plater,
Sorry for the trouble.
the sending and receiving data are working fine but when we are sending data packets continuously within milli seconds then the data is being mixed.
i want to know whether we can use lock() concept and does it effect the performance...................
its urgent pls.


Thanks & Regards
Srinivas
Feb 28 '08 #5
Plater
7,872 Expert 4TB
Are you using threads / events to trigger data sending? Because there is no garuntee there who goes first.
Go look into Mutex objects if you really need to do the locking, they're good for that kinda thing.
Feb 28 '08 #6
hi Plater,
when i am closing the application and again starting the application getting message that only one usage of each socket address(protocol/network/address/port) is normally permitted and i want the port number also when i close the application

Regards,
Nagasrinivas
Mar 10 '08 #7
Plater
7,872 Expert 4TB
Sounds like you are not correctly closing the socket(s) when you exit your program.
Perhaps a thread is still running?
Also: If you close a socket that then gets data sent to it when its still in "closing" state, the port that socket used stays locked down for a some timeout period. I believe there is a .SocketOption you can set to avoid that. Something like "NoLinger" I think.
Mar 10 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by pyguy2 | last post: by
4 posts views Thread by 0k | last post: by
5 posts views Thread by John Sheppard | last post: by
2 posts views Thread by djc | last post: by
11 posts views Thread by atlaste | last post: by
8 posts views Thread by =?Utf-8?B?Sm9obg==?= | last post: by
14 posts views Thread by =?Utf-8?B?TWlrZVo=?= | last post: by
3 posts views Thread by Stuart | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.