Hello, The following module creates a UDP kernel socket which calls sock_recvms. after insmoding the module , netstat -nl | grep 4000 shows that indeed a socket was created and that it listens on port 4000. However, after running rmmod on the module, it does **not** close the socket. netstat -nl | grep 4000 shows that it **does** exist; the "rmmod" itself hangs, and there are no kernel messages. Any ideas? The code of the module is below: static int createUdpInSocket(void) { int res; struct sockaddr_in server; int servererror; unsigned char *buf; printk( KERN_ERR "createUdpInSocket\n" ); if( sock_create( PF_INET,SOCK_DGRAM,IPPROTO_UDP,&udpInserversocket)<0 ) { printk(KERN_ERR "server: Error creating udpserversocket.\n" ); return -EIO; } server.sin_family = AF_INET; server.sin_addr.s_addr = INADDR_ANY; server.sin_port = htons((unsigned short)4000); servererror = udpInserversocket->ops->bind(udpInserversocket, (struct sockaddr *) &server, sizeof(server) ); { struct msghdr msg; struct iovec iov; mm_segment_t oldfs; int size = 0; int len = 160; iov.iov_base = buf; msg.msg_flags = 0; msg.msg_name = &server; msg.msg_namelen = sizeof(struct sockaddr_in); msg.msg_control = NULL; msg.msg_controllen = 0; msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = NULL; oldfs = get_fs(); set_fs(KERNEL_DS); printk("before sock_recvmsg in %s %s\n",__FUNCTION__,__FILE__); size = sock_recvmsg(udpInserversocket,&msg,len,msg.msg_flags); printk("after sock_recvmsg in %s %s\n",__FUNCTION__,__FILE__); set_fs(oldfs); } } static int kernThread(void *arg) { allow_signal(SIGKILL); createUdpInSocket(); return 0; } static int __init nic_init(void) { int ret; void *kdata; p = kthread_run(kernThread,kdata,"myKernThread"); return 0; } ////////////////////////////////////////////////////////////////////////////// static void __exit nic_exit(void) { printk("in nic_exit\n"); if (p) kthread_stop(p); if (udpInserversocket) sock_release(udpInserversocket); } ////////////////////////////////////////////////////////////////////////////// module_init(nic_init) module_exit(nic_exit) Regards, Mark Ryden -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ