Click to See Complete Forum and Search --> : Read data form socket


paulina_lui
December 2nd, 2002, 02:49 PM
I have an application that after being started send all the messages that it generates to a UDP socket created on port 7865.

Now I have to write a logger function which reads all these messages and saves them into a file as well as displays them.

The data is sent as a struct of the form

typeded struct{
int task,len,type,resource;
} Resc;


please help

vinodp
December 2nd, 2002, 05:39 PM
From ur post I am not sure what exactly ur problem is & what do u want.
From ur post it seems u want to create some king of logging mechanism where client going to send some specific message to server & server going to log that message in some data store.

quote:
------------------------------------------------------------------------------------
I have an application that after being started send all the messages that it generates to a UDP socket created on port 7865.
------------------------------------------------------------------------------------
I really didnt get what ur mentioning here.
I think ur data sending application is going to act as client then i think that doesn't matter on what port r u creating a socket

quote:
------------------------------------------------------------------------------------
Now I have to write a logger function which reads all these messages and saves them into a file as well as displays them
------------------------------------------------------------------------------------
i dont think so its good idea to combine the logging & displaying logic in one place
its better if separate this functionality create 2 diff. application.

The general architecture should be something like this
there is going to 3 application
1)Client: which is going to send the messages to log
2)Server: which is going to listen (waiting for messages from client) on particular port & going to log the messages
3)UI: which is going to read the logged messages & display it

u can lot of info about general client server apps on net.

HTH
Vinod

kuphryn
December 2nd, 2002, 07:25 PM
Post a specific question.

In short, you will use WSARecv() or recv().

Kuphryn