日期:2014-05-16 浏览次数:20887 次
/*-
* vi:set ts=4 sw=4:
*/
#ifndef lint
static const char rcsid[] = "$Id$";
#endif /* not lint */
/**
* @file clnt.c
* @brief
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int fd;
int ret;
struct sockaddr_in addr;
struct linger linger;
char buf[] = "2013-08-13 14:29:53";
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr("127.0.0.1");
addr.sin_port = htons(12345);
fd = socket(PF_INET, SOCK_STREAM, 0);
if (argc == 2 && atoi(argv[1]) > 0) {
linger.l_onoff = 1;
linger.l_linger = 0;