Link to home
Start Free TrialLog in
Avatar of tatikor_143
tatikor_143

asked on

Receive data from client

Hello experts,

I am a server waiting for the client and receivng the data from the client periodically.When I receive the data ,I have to make some calculations on the data received and I have to paint the form accordingly.I am working in VC++ .NET.
I will be receiving the data from the client for every 10 seconds of time.I want my program to wait at the receive function till it recives the data and then paint periodically.

I made the socket non blocking but I am not able to achieve what I wanted.

Here is the sample of code......

do
{
iResult = recv(s,buffer,256,0);//I want the function to wait here till it receives the data from client for every iteration.
//do some paint opertion here.....
}wjile(iResult!=-1);

Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image


Perhaps I don't understand.  If the client is sending data every 10 seconds, just define the server socket as blocking.


Kent
Avatar of tatikor_143
tatikor_143

ASKER

If I make the socket as blocking then I will not be able to perform the paint operations but I am sure that I will be receiving the data.
ASKER CERTIFIED SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi kent,

I inserted the code in a button handler......
When I click the button,it starts receiving the data from the client and paints on the form......
If I create  a thread for receiving the data then How can I suynchronise the paint operation ?
any idea.....
I am still in a confusion wether I have to look towards the socket side or towartds the .NET side....

I dont know Wether I am going in a right way.....