Underground - Bhasker V K,the Sandman's Hideout

Thanks for dropping in...I got this running since i needed a place to post info that i found interesting which,i could access online .lotta stuff here might find a few glances ...so make ur self @ home...and hope u find the links/info ur looking for or atleast giv u a hint 'what you should ' be looking for .
Keep Clicking,
Bhasker V K
VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1 ]
Subject: time


Author:
bhasker
[ Next Thread | Previous Thread | Next Message | Previous Message ]
Date Posted: 01:15:19 08/17/05 Wed
Author Host/IP: NoHost/202.71.147.34

#include
#include
int main()
{
time_t ticks;
char buff[100];
ticks =time(NULL);
printf("%.24s\r\n",ctime(&ticks));
}
*******************************************************
now sending the date over a connection.

CODE:

#include
#include
#include
#include
#include
#include
int main()
{
int servSock,connSock;
int childPID;
int len;
time_t ticks;
char buff[100];
struct sockaddr_in cliaddr,servaddr;
int PORT =7890;

servSock=socket(AF_INET,SOCK_STREAM,0);

bzero(&servaddr,sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr=htonl(INADDR_ANY);
servaddr.sin_port=htons(PORT);

bind(servSock,(struct sockaddr*) &servaddr,sizeof(servaddr));

listen(servSock,5);

for(;;)
{
len=sizeof(cliaddr);
connSock=accept(servSock,(struct sockaddr*)&cliaddr,&len);

ticks =time(NULL);
snprintf(buff,sizeof(buff),"%.24s\r\n",ctime(&ticks));

write(connSock,buff,strlen(buff));


close(connSock);
}
}


***********************
Cllient side
CODE:

#include
#include
#include
#include
#include
#include

int main(int argc,char **argv)
{

int sockfd;
char Str[100];
struct sockaddr_in servaddr;

sockfd=socket(AF_INET,SOCK_STREAM,0);
if(sockfd<0)
printf("error in sock creation");

bzero(&servaddr,sizeof(servaddr));
servaddr.sin_addr.s_addr = inet_addr("172.16.3.25");
servaddr.sin_family=AF_INET;
servaddr.sin_port=htons(7890);
//inet_pton(AF_INET,argv[1],&servaddr.sin_addr);

connect(sockfd,(struct sockaddr*)&servaddr,sizeof(servaddr));

read(sockfd,Str,100);

printf("%s",Str);

exit(0);
}

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Post a message:
This forum requires an account to post.
[ Create Account ]
[ Login ]
[ Contact Forum Admin ]

"
"
Forum timezone: GMT-8
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.
if u want to post ,send an email to bosky101@indiatimes.com ..this is to maintain the integrity of this forum ..cheers
Keep Clicking,
bosky101 Click here to listen to my music station