哪位高手能给小弟我一个有关 socket/client 编程的例子啊

谁能给我一个有关 socket/client 编程的例子啊?
大致要求是例如   Server   从   端口10000   接受到一条消息,然后   accept   ,要记录下时间,按秒。记录下客户端的IP,读取之后,形成一个File。   万分感谢!!!


------解决方案--------------------

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

#include "..\Common\nbcommon.h "

#define MAX_BUFFER 2048
#define SERVER_NAME "TEST-SERVER-1 "

DWORD WINAPI ClientThread(PVOID lpParam);

//
// Function: ListenCallback
//
// Description:
// This function is called when an asynchronous listen completes.
// If no error occured create a thread to handle the client.
// Also post another listen for other client connections.
//
void CALLBACK ListenCallback(PNCB pncb)
{
HANDLE hThread;
DWORD dwThreadId;

if (pncb-> ncb_retcode != NRC_GOODRET)
{
printf( "ERROR: ListenCallback: %d\n ", pncb-> ncb_retcode);
return;
}
Listen(pncb-> ncb_lana_num, SERVER_NAME);

hThread = CreateThread(NULL, 0, ClientThread, (PVOID)pncb, 0,
&dwThreadId);
if (hThread == NULL)
{
printf( "ERROR: CreateThread: %d\n ", GetLastError());
return;
}
CloseHandle(hThread);

return;
}

//
// Function: ClientThread
//
// Description:
// The client thread blocks for data sent from clients and
// simply sends it back to them. This is a continuous loop
// until the sessions is closed or an error occurs. If
// the read or write fails with NRC_SCLOSED then the session
// has closed gracefully so exit the loop.
//
DWORD WINAPI ClientThread(PVOID lpParam)
{
PNCB pncb = (PNCB)lpParam;
NCB ncb;
char szRecvBuff[MAX_BUFFER];
DWORD dwBufferLen = MAX_BUFFER,
dwRetVal = NRC_GOODRET;
char szClientName[NCBNAMSZ+1];

FormatNetbiosName(pncb-> ncb_callname, szClientName);

while (1)
{
dwBufferLen = MAX_BUFFER;

dwRetVal = Recv(pncb-> ncb_lana_num, pncb-> ncb_lsn,
szRecvBuff, &dwBufferLen);
if (dwRetVal != NRC_GOODRET)
break;
szRecvBuff[dwBufferLen] = 0;
printf( "READ [LANA=%d]: '%s '\n ", pncb-> ncb_lana_num,
szRecvBuff);

dwRetVal = Send(pncb-> ncb_lana_num, pncb-> ncb_lsn,
szRecvBuff, dwBufferLen);
if (dwRetVal != NRC_GOODRET)
break;