Software :: Blocking Socket Vs Non-blocking Socket?
Mar 31, 2010My question is quite simple:What are type of applications where socket in blocking mode can be used ?
And where non-blocking mode to be used ??
TCP is blocking by default.
My question is quite simple:What are type of applications where socket in blocking mode can be used ?
And where non-blocking mode to be used ??
TCP is blocking by default.
Been trying all sorts of different things to implement a non-blocking send on a TCP server socket.As I kill the client, the server keeps blocking on the send no matter what. Am I missing something? Any other way to do that without involving any additional thread?
View 4 Replies View RelatedI need to write program for non blocking socket connections.I have made extensive research but could only get to non blocking READ or WRITE after the connection is established. run the program do a series of tasks (ex: counter printing time on screen) if there is request for connection, connect send or receive data.
View 1 Replies View RelatedI'm running Ubuntu 10.10 64bit, and I'm a newbie when it comes to networking.
My issue is that there seems to be a socket bound to a port blocking MongoDB from accessing it's usual port 27017. The strange thing that it was working just fine until recently and I can't figure out what I did to screw things up... I can make it use a different port but the reason why it can't bind to the default port and why I can't fix it is really bothering me. I've tried rebooting the machine even with nothing else running when I try to run Mongo is still blocked giving the following message:
Code:
ropes@ropes:~/mongodb-linux-x86_64-1.8.0/bin$ ./mongod
./mongod --help for help and startup options
Sun Mar 27 14:08:14 [initandlisten] MongoDB starting : pid=2718 port=27017 dbpath=/data/db/ 64-bit
[Code]....
For system calls, is blocking or non-blocking default in C? Simple question, just am not seeing the answer super quickly.
View 4 Replies View RelatedI have a device that is working on modbus protocol andI have written a small program(with block TCP read method ) to read its registers via modbus protocol.my program is working very well but except those times that I unplug the Ethernet cable or turning off the modbus gateway during programs work.at this time my program stops on recv system call (if it reach this system call exacly when I unplug Ethernet cable or turning off the modbus gateway during programs work).I changed my source to work in nonblock TCP method, at this time with the same situation my program does not stop/block on recv system call but after pluging back the Ethernet cable or resuming the connectivity situation back it reads data incorrectly .this is my code:Quote:
#define DEBUG
#include <fcntl.h>
#include <string.h>
[code]...
I want to configure socket timer to release socket(port) once the connection is terminated. Do we have something in Linux OS to configure this delay to release socket?.
Any command, link or man-page anything will be helpful.
I browsed a lot but unable to find it.
Anyone knows the difference between a socket and TCP connection for connecting to an external system?
View 1 Replies View RelatedI had installed Fedora 10
Below is the output of uname -a
Linux 2.6.27.5-117.fc10.i686.PAE #1 SMP Tue Nov 18 12:08:10 EST 2008 i686 i686 i386 GNU/Linux
I need to enable telnet service on it, then found xinetd and telnet-server not installed,
Then I had installed below
First I had installed Xinetd: xinetd-2.3.14-21.fc10.i386.rpm
then I had installed telnet-server: xinetd-2.3.14-21.fc10.i386.rpm
After installation I executed below commands
Service xinetd start
Chkconfig xinetd on
Chkconfig telnet on
Service iptables stop
Chkconfig iptables off
Iptables �F
After I had tried telnet localhost ----IT FAILED
when I run telnet server manually by issuing the below command
/usr/sbin/in.telnetd, I get below error
[COLOR="Red"]/usr/sbin/in.telnetd: getpeername: Socket operation on non-socket[/COLOR]
I have other system running same OS, I had followed the same steps discussed above to enable telnet, It works fine on it.
i'm writing a simple program of client socket program. Here below is the code sample which i'm writing...
Code:
//tcp_client.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include<string.h>
#include<stdlib.h>
[Code].....
the above code works fine.if we copmile and run ./a.exe 192.xx.xx.xxx 1111 and press enter it works fine..everytime it asks "Please enter the message: " and if give that will be displayed in server. but my problem is i dont want to print everytime "Please enter the message: " i just want to feed some words one by one to the socket.
im getting that error in my code for some reason. I compiled my code, and when i try to run this server it throws me an error on my call to setsocketopt(). The only way it can reach that part of my loop is if it succeeds when it calls sock() so I dont understand why the error says its an operation on a non-socket. Im just trying to set up a server to pass messages from a client to it a viceversa. Here is the code:
Code:
int main()
{
int socket_fd, new_socket_fd, k;
struct addrinfo hints, *server_info, *p;
struct sockaddr_storage peer_address;
code....
We are seeing recv err on socket 31: 0x36. What could be meaning of the error?.
View 1 Replies View RelatedI am pragmatically trying to upload a list of files from my client machine to a proFTPd server I have running on Ubuntu. Every time I get several (around fifty) files into the transfer, I get the following error: Quote: Connection reset by peer: socket write error
I am able to remotely upload 25,000 small files of ~ 1K in size, but when I go to upload hundreds of 2-4 Mb files, I get a socket write error. Am I using up all available sockets before they can be released? If so, how do I release the sockets? If not, what does this error mean and why am I getting it?
iam just trying to connect to server which accepts one client and server will read(blocking operation) infinitely, but After closing the client socket the server "read operation" is returning zero and "errno variable(in errno.h)" value is also zero. how can i detect whether a client socket is closed/active..?
client.c
Serv_Addr.sin_family = AF_INET;
Serv_Addr.sin_addr.s_addr = inet_addr("127.0.0.1");
Serv_Addr.sin_port = htons(26553);
if( 0 > connect (Serv_Fds,&Serv_Addr,sizeof(Serv_Addr)) )
{
perror("connect");
return 0;
[Code]....
In looking at the release notes, I saw the comment File locations changes:
* MySQL socket file and pid file were moved from /var/lib/mysql to more reasonable location /var/run/mysql by default.
* MySQL log files are in /var/log/mysql. Not sure what I was supposed to do with that information. So I ignored it. Now, I am finding some issues with it. The web server works, but any connection to the database fails with 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)The thought dawned on me that maybe all my databases were erased and none set up. Going in to the terminal, I could connect and list and query the databases. So even though I backed them up, they still are there!
phpMyAdmin gives the same error message.
However, when I go into MySQL Administrator, it works fine.
I forgot where I saw it, but the socket is still set to var/lib/mysql. I could not find any mysql install log and would say what was in my cnf.my, but it still doesn't exist just as it has not in the past. Not sure if I should allow the MySQL Administrator to create it since I always ignored the prompt in the past and it worked. (Just wishing to keep the defaults)
At first I thought the upgrade upgraded the MySQL, but it's still 5.1.39 as I believe before. I've un-installed mysql-server and re-installed it with no change.
Can anyone can tell me how to get the socket to /var/run/mysql or what else is wrong? I read one place where mysql is supposed to set it up.
My friend bought an old hard drive. He noticed something with the hard drive that it was just replaced with a SATA socket. So meaning, the SATA socket was soldered to the PATA hard disk to replace the PATA socket to SATA socket to make it a SATA.
Now the question is:
1. Does the Transfer Rate of the harddisk (that has been replaced from PATA socket to SATA socket) would be SATA transfer rate? OR would still be PATA transfer rate?
I have a SSH server on Ubuntu 10.04 running behind a NAT. I have done the port-forwarding at the router. However say for example I want to restrict people connecting to the SSH server by country IP's. When I configure ufw with the following rule it still lets the IPs that are restricted through. Any idea why
sudo ufw allow from xxx.xxx.xxx.xxx/24 to any port 2556
My ISP (Cox) is blocking port 80 and I would like to know if there is a way to open it again. I am to taking about 8080, 8000 or 81 I want to use 80 so I can host my website and every one can access it without the need to put [url]:[PORT] at the URL
View 2 Replies View RelatedI'm trying to install libbz2-dev on my labtop.I'm running Kubuntu 10.04.Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
View 3 Replies View RelatedI've a CentOS Box with no control panel.. I used to manage it via SSH. Any way, I've installed CSF/LFD on it.. and it seemed to be working just fine. The only problem I've encountered is that when I start and enable CSF, messages and emails keeps stocked in the mail queue.. I've double checked and made sure needed ports are opined.. But, I still have the problem.
View 2 Replies View RelatedI am trying to backup my system with a script I found here. It gives me an error message of invalid blocking factor for --exclude=lost+found I have no idea what this means. I tried to search this form for that message and received no hits.
View 2 Replies View RelatedI can see what Firestarter is blocking in the Firestarter/Events tab, but after reading all the man pages of UFW, I still don't know how to check what the UFW is blocking.
View 9 Replies View RelatedAfter reading a lot about networking and security I decided to check the security of my own ubuntu box. So I went installing Nmap and discovered that port 139 was "open". Since I 'd read how to use ufw I created a deny rule for port 139. After a second scan with Nmap it still said that port 139 was open as shown below.
[Code]...
I'm trying to use VNC on my headless desktop server that's running lucid, but I can only use SSH because a pop asking me to unlock the keyring shows up every time I try to use VNC. I don't have a monitor for that desktop, so I was wondering, is there any way to remove the keyring/to automatically unlock it during autologin? I don't remember what a site I found it on, but I used this to remove my keyring yesterday. It's no longer working today.
View 4 Replies View RelatedI need assistance blocking application in Ubuntu 10.04. block all applications for certain users if they do not exist in a certain directory.For example,we would like to prevent users from launching a portable copy of Firefox from a portable HDD or Flash drive.
View 1 Replies View Relatedim having a bit of a problem with Firestarter, i have Transmission opened and i am downloading a movie but when i check Firestarter i see hundreds and hundreds of Ip's that are blocked, and like 10ip's every second that get blocked.
[Code].....
I have the default to deny all. The only rule I have in there is:
Code:
To Action From
-- ------ ----
[code]....
I might be misunderstanding the log but it looks like UFW is blocking connections. I want to allow all incoming and outgoing. I guess what I'm saying is that the servers on my computer will open ports but all other ports should respond with closed just like a default Ubuntu install. Trying to use UFW to monitor connections without really doing any firewalling.
Code:
Aug 1 07:14:07 universal-mechanism kernel: [311111.963762] [UFW BLOCK] IN=eth0 OUT= MAC=00:1f:c6:8a:e9:66:00:01:5c:32:f4:c1:08:00 SRC=72.21.203.146 DST=174.44.178.56 LEN=40 TOS=0x00 PREC=0x00 TTL=233 ID=51984 DF PROTO=TCP SPT=80 DPT=54466 WINDOW=8201 RES=0x00 RST URGP=0
I want to block the icmp packets(ping) from the other computer to my RHEL-4 what's the syntax I should use to do so in IPTABLES.
View 2 Replies View RelatedI've setup ufw rules on my system but noticed that the rule i created to allow traffic from my local network is still dropping some RST and ACK packets. here's part of the output of dmesg
[Code]...