Snort mailing list archives

Re: yet another unix socket question...


From: "Dr. Richard W. Tibbs" <ccamp () oakcitysolutions com>
Date: Sat, 12 Jan 2002 18:09:27 -0500

OOps. Sorry list, I did a little google search and realized my problem.
Please ignore this thread.
What is apparently the problem is that a socket file handle named /tmp/yaddafile is created upon first (successful) execution of the bind call. Then, forever thereafter, unless you rm -f /tmp/yaddafile, bind gives you error 98, "address in use".

Thx...

Dr. Richard W. Tibbs wrote:

Dear list :

After searching the archives (and finding a few postings; thanks to Fyodor) I am still not able to figure out my problem. I am trying to write a reciever socket program to use with snort using the output alert to unixsock facility.

The attached code snipet fails upon the bind command, with errno 98.
I have debugged the code in kdb and the myname struct looks fine, as does the sock variable.

Any idea what is wrong ?

Thanks in advance....


------------------------------------------------------------------------




  sock = socket(AF_UNIX, SOCK_DGRAM, 0);
  if (sock < 0) {
    printf("socket failure %d\n", errno);
    exit(1);
  }

  myname.sa_family = AF_UNIX;
  strcpy(myname.sa_data, "/tmp/somefile");
  addrlen =  strlen(myname.sa_data) + sizeof(myname.sa_family) ;
  if (bind(sock, (struct sockaddr *) &myname, addrlen ) < 0) {
    printf("bind failure %d\n", errno);
    exit(1);
  }

  cnt = recvfrom(sock, buf, sizeof(buf),
    0, &from_name, &fromlen);

/* etc.... */




_______________________________________________
Snort-users mailing list
Snort-users () lists sourceforge net
Go to this URL to change user options or unsubscribe:
https://lists.sourceforge.net/lists/listinfo/snort-users
Snort-users list archive:
http://www.geocrawler.com/redir-sf.php3?list=snort-users


Current thread: