[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

3264.0. "INET stream event handler causes Xtk to croak.." by SX4GTO::HOLT (Robert Holt ISVG West) Mon Aug 27 1990 23:37

    
    I am trying to set up my applcation to listen on an INET domain
    stream socket. I create it in the usual manner, letting ULTRIX 
    fill in the port field in sockaddr_in. Then I bind it, call 
    listen,  and use the socket fds in an XtAppAddInput call (with 
    read mask). 
    
    Problem is that when the first X event is handed to my application,
    it croaks in _XWaitForSomething.
    
    This code works perfectly fine when a socketpair, (obviously created 
    in the UNIX domain) is used....
    
    Is there any limitation on which kind of sockets may be used with
    the toolkit..?
    
T.RTitleUserPersonal
Name
DateLines
3264.1ABYSS::dikeTue Aug 28 1990 08:0927
I have done that (XtAddInput on an inet stream socket) without any problems.
Here are the relevent bits of code:

  int i, s;
  struct sockaddr_in sa;

 if((s = socket(AF_INET, SOCK_STREAM, 0)) == -1){
    perror("socket");
    exit(1);
  }
  sa.sin_family = AF_INET;
  for(i=MIN_PORT;i<MAX_PORT;i++){
    sa.sin_port = i;
    if(bind(s, &sa, sizeof(sa)) != -1) break;
  }
  if(i == MAX_PORT){
    perror("bind");
    exit(1);
  }
  if(listen(s, 5) == -1){
    perror("listen");
    exit(1);
  }

  ...

  XtAddInput(s, XtInputReadMask, do_accept, NULL);
3264.2SX4GTO::HOLTRobert Holt ISVG WestTue Aug 28 1990 12:074
    
    Mine works when XtAddInput is substituted for XtAppAddInput...
    odd.