Sponsored Content
Full Discussion: why daytime don't work?
Top Forums Programming why daytime don't work? Post 302322903 by konvalo on Thursday 4th of June 2009 11:12:07 PM
Old 06-05-2009
Question why daytime don't work?

Following code is detecting solaris daytime,when I run it,I can't get any result,code is follows:

Code:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define BUFFSIZE 150
int main(){
  struct sockaddr_in serv;
  char buff[BUFFSIZE];
  int sockfd,n;
  if((sockfd=socket(PF_INET,SOCK_DGRAM,0))<0)
     err_sys("socket error");
  bzero((char *)&serv,sizeof(serv));
  serv.sin_family=AF_INET;
  serv.sin_addr.s_addr=inet_addr("10.10.10.9");
  serv.sin_port=htons(13);
  if(sendto(sockfd,buff,BUFFSIZE,0,(struct sockaddr *)&serv,sizeof(serv))!=BUFFSIZE)
     err_sys("sendto error");
  if((n=recvfrom(sockfd,buff,BUFFSIZE,0,(struct sockaddr *)NULL,(int *)NULL))<2)
     err_sys("recvfrom error");
  buff[n-2]=0;
  printf("%s\n",buff);
}

$a.out
aa --here I input a line

I can't get any information from daytime, the code is under the same machine '10.10.10.0". Why I can't get information of daytime?

Thanks
 

9 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

How come sigs don't work?

They appear to be turned on, I entered mine in. The check boxes are all checked. And yet, no sigs? (4 Replies)
Discussion started by: l008com
4 Replies

2. UNIX for Dummies Questions & Answers

Things in tutorials that don't work.

I am thankful for this site and for the many links provided. I have been going through one of the tutorials, but as I try some things, they don't seem to work. I am wondering if there is something I need first before being able to use a tutorial (like version number (HP-UX) or how I am getting... (1 Reply)
Discussion started by: arungavali
1 Replies

3. Programming

why printf() function don't go work?

I use FreeBSD,and use signal,like follows: signal(SIGHUP,sig_hup); signal(SIGIO,sig_io); when I run call following code,it can run,but I find a puzzled question,it should print some information,such as printf("execute main()") will print execute main(),but in fact,printf fuction print... (2 Replies)
Discussion started by: konvalo
2 Replies

4. Shell Programming and Scripting

Use variable in sed don't work.

Hi all. I have a script as below: cutmth=`TZ=CST+2160 date +%b` export cutmth echo $cutmth >> date.log sed -n "/$cutmth/$p" alert_sbdev1.log > alert_summ.log My purpose is to run through the alert_sbdev1.log and find the 1st occurence of 'Jan' and send everything after that line to... (4 Replies)
Discussion started by: ahSher
4 Replies

5. Programming

why printf don't work?

I use Solaris 10, I use following code: #include <signal.h> int main(void){ printf("----------testing-----------"); if(signal(SIGUSR1,sig_usr)==SIG_ERR) err_sys("can't catch SIGUSR1"); for(;;) pause(); sig_user(int signo){ ..... } when I run above code,it print nothing... (3 Replies)
Discussion started by: konvalo
3 Replies

6. HP-UX

awk don't work in hp-ux 11.11

Hello all! I have problem in hp-ux 11.11 in awk I want to grep sar -d 2 1 only 3 column, but have error in awk in hp-ux 11.11 Example: #echo 123 234 | awk '{print $2}' 123 234 The situattions in commands bdf | awk {print $5}' some... In hp-ux 11.31 - OK! How resolve problem (15 Replies)
Discussion started by: ostapv
15 Replies

7. Solaris

I don`t understand how It work (about startup script)?

Hi all. The startup script in /usr/local/bin. After user login the script run an application. Iwould in the same way run the another application. How to make It similar? Where I must to look? Regards. (3 Replies)
Discussion started by: wolfgang
3 Replies

8. Solaris

Open Terminal Don't work

Hi, I installed solaris 10 x86 on my local system. it was working fine. today when i started the system, it started up without any problem. when i tried to open the terminal it didn't open any terminal. Plz help me (0 Replies)
Discussion started by: malikshahid85
0 Replies

9. Shell Programming and Scripting

Equivalence classes don't work

Hello: I can't get equivalence classes to work in globs or when passing them to tr. If I understood correctly, matches e, é, è, ê, etc. But when using them with utilities like tr they don't work. Here's an example found in the POSIX standard: I decided to create the aforementioned files in... (9 Replies)
Discussion started by: Cacializ
9 Replies
SHUTDOWN(2)						     Linux Programmer's Manual						       SHUTDOWN(2)

NAME
shutdown - shut down part of a full-duplex connection SYNOPSIS
#include <sys/socket.h> int shutdown(int sockfd, int how); DESCRIPTION
The shutdown() call causes all or part of a full-duplex connection on the socket associated with sockfd to be shut down. If how is SHUT_RD, further receptions will be disallowed. If how is SHUT_WR, further transmissions will be disallowed. If how is SHUT_RDWR, further receptions and transmissions will be disallowed. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EBADF sockfd is not a valid descriptor. ENOTCONN The specified socket is not connected. ENOTSOCK sockfd is a file, not a socket. CONFORMING TO
POSIX.1-2001, 4.4BSD (the shutdown() function call first appeared in 4.2BSD). NOTES
The constants SHUT_RD, SHUT_WR, SHUT_RDWR have the value 0, 1, 2, respectively, and are defined in <sys/socket.h> since glibc-2.1.91. SEE ALSO
connect(2), socket(2), socket(7) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-12-03 SHUTDOWN(2)
All times are GMT -4. The time now is 10:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy