Programming :: TCP Server Not Detecting Broken Connection?

Jul 4, 2011

I am attempting to write a server application in C on a linux machine which listens for TCP connections and transfers data. I am trying to detecton the server side when the connection is broken. The closest thing that I got to work was looking at the return value from sending data. For example the server�s job is to mainly read data from the socket but to test if the connection is still up the server sends data periodically back to the client. I look at the return value from send() to determine if the connection is broken e.g.

Code:int ret = send(session->clientSocket, &data[sentCnt], count - sentCnt, MSG_NOSIGNAL)I found that this does not immediately return an error when the connection is broken. The reason for this is because even though the connection is broken send() is still successful because it is able to put it on the network buffer. To fix the issue I did the following things;

Code:
//set send timeout
struct timeval timeout;

[code]...

View 3 Replies


ADVERTISEMENT

Networking :: Detecting Broken Connection Before Sending Data With Sockets?

Oct 28, 2010

I am writing a code in Python where a socket client changes data with the server. That works nice if the connection is up. However it is also supposed to work offline. So I need to be able to detect if the connection is up before sending data, but I was not able to do so. A summary of the code is like that:

Code:
try:
socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket.connect( (self.host, self.port) )
connected = True
except:
connected = False

if connected:
data = "some data byte"
try:
socket.send(data)
except:
connected=False
socket.close()

If I unplug the cable after the connection is ready then the socket sends data and does not detect the connection failure. What is amazing is that the client detects the connection failure just after the cable has been plugged again. Of course there is a loop in the code above and always that connected==False a new connection is made. How could the program detect the connection failure before sending data and then lead the code to an exception?

View 3 Replies View Related

Server :: Yum Broken - While The Update Was In Progress My SSH Connection Got Disconnected

Nov 5, 2010

I logged on to one of my servers and ran a yum update, while the update was in progress my SSH connection got disconnected.

I logged in through a new connection when connectivity was restored and looked at running processes. It looked like yum was hung so I killed it (big mistake and one I won't repeat).

Now, when I try and run yum, I get the following:

Quote:

yum update: There was a problem importing one of the Python modules required to run yum. The error leading to this problem was:

Please install a package which provides this module, or verify that the module is installed correctly.

It's possible that the above module doesn't match the current version of Python, which is:

If you cannot solve this problem yourself, please go to the yum faq at:[url]

I have tried hunting around for the correct version of libelf without much luck.

Is there anything I can do to get yum working again?

The server is running Centos 5.2

View 2 Replies View Related

Server :: Frequent Broken Pipes From SSH Connection After Power Loss?

Apr 19, 2011

I have three machines networked to my desktop which run a bunch of simulations in parallel. As they're running, I connect to them via SSH and screen to keep an eye on the runs and look at the output. They stay usually connected for days at a time. The SSH servers and client are running Fedora 14. Yesterday one of my coworkers accidentally yanked the plug on one of the servers while it was running. When I powered it up again, I started getting some odd connection problems. I couldn't connect to it via SSH initially because I got the Remote Host Identification Changed (RSA host key changed) error. I deleted the key in .ssh/known_hosts, which allowed me to connect, but it denied my password. I then logged into that machine locally, restarted sshd, and removed .ssh/known_hosts again. Now I can log in via SSH without problems. However, the connection dies with a "Write failed: Broken pipe" error every few minutes (as opposed to the other two machines, which stay connected indefinitely).

So my questions are:
1.) why would a power loss affect the behavior of the SSH server?
2.) why do I keep getting broken pipes now?

View 4 Replies View Related

Fedora Networking :: 14 Is Not Detecting Wi-fi Connection?

May 28, 2011

have installed fedora 14 in my dell inspiron laptop and it is not detecting wi-fi of my college in fedora but in windows 7 it is detecting. how i can sort-out

View 14 Replies View Related

Ubuntu :: 10.10 Is Not Automatically Detecting The Wireless Connection?

Oct 10, 2010

I installed ubuntu 10.10 and it is not automatically detecting the wireless connection and showing message firmware missing. how to connect to wireless. I installed on the laptop.

View 6 Replies View Related

Ubuntu Multimedia :: Not Detecting Displayport Connection?

Apr 23, 2011

I have an 27" iMac which I wish to use as display for my Ubuntu machine using it's mini Displayport as perTo that end I bought a new Intel DH67GD motherboard and 2600k CPU and a Displayport->Mini Displayport cable.However it seems that X doesn't detect the displayport connection correctly. When I boot the Ubuntu machine the iMac correctly switches to that input and Intel motherboard screen appears on the display followed by the grub interface.However it seems that when X should start it doesn't recognise the Displayport connection. The iMac goes back to displaying it's own screen and the X logs don't seem to recognise the connection

Code:
[ 32.854] (==) intel(0): video overlay key set to 0x101fe
[ 32.854] (II) intel(0): Output VGA1 using monitor section Configured Monitor

[code]....

View 1 Replies View Related

Ubuntu Installation :: Inspiron - No Internet Connection Is Detecting

Aug 15, 2010

i installed ubuntu 10.04 in inspiron n4010 laptop. No internet connection is detecting. i have both wifi and wired network. in the desktop panel icon of network it shows networking is disabled ..

View 9 Replies View Related

Networking :: Detecting And Logging Lost Internet Connection?

Dec 8, 2010

We have an Asterisk machine that we suspect periodically loses internet connectivity, causing all calls to drop. First, would this sort of thing be logged anywhere out of the box? I haven't noticed anything in /var/log, but that doesn't mean it's not there. If this is not typically logged, how I might go about logging it? I'm currently running a bash script from cron every 5 or 10 minutes which pings Google and writes success or failure messages to a log file. This works fine for extended outages, but if the internet connection drops and comes back between cron runs, it won't be caught.

View 4 Replies View Related

Programming :: C/C++ - Program Detecting New Sockets

Jul 25, 2010

I need to create a C/C++ program in Linux that succeeds in detecting how many tcp-sockets and what tcp-sockets are created by the other processes in the system in a particular time interval (e.g., the interval time this application is running in). Then, I'd need to get some information like local/remote port number and local/remote ip address of each of these sockets.

View 8 Replies View Related

Programming :: Library In C - C++ - For Web Server Connection ?

Jul 14, 2010

Is there any library in C(C++) for web server connection?because I do not want use socket.

View 1 Replies View Related

Programming :: BASH: Detecting CTRL+C Being Pressed?

Jan 28, 2010

I am working on a script and I want it to detect if CTRL+C is pressed at any time during the script and have it not Break the script and display a message stating to use CTRL+Z instead. How can I do that?

View 9 Replies View Related

Programming :: Detecting Wireless Network Interfaces?

Dec 9, 2010

My C++ program must be able to detect EVERY Wireless Network Interfaces under Linux operating system and display the interface names on the screen.How can my application achieve this?Is there any sample codes?Is there any third party libraries can do this?Notes: The detected wireless network interfaces should also include the virtual interfaces, like the one created by Aircrack-NG's Airmon-NG script.

View 1 Replies View Related

Programming :: Detecting Office 2007 Files By Script

Jul 24, 2009

We have a system where users can upload files, and then various things happen depending on what kind file it is. The check uses the file command.But for Office 2007 files, the file command says it is a ZIP file.

These files are in fact ZIP files, I can unzip them, and then I get a lot of small weird files. We don't need to do anything about these files, but it's a problem when the system handles them as ZIP files.So I need some way of detecting these files, and not by file extension (.docx) since it is often incorrect. Many of the users are Macintosh users and they don't always use a file extension at all.

View 2 Replies View Related

Programming :: PHP - Connection To Remote Server To Edit File?

Mar 14, 2010

I have a webGUI in php where users can make certain settings. How can I edit a file on a remote server from my php webserver? Currently I use my FTP client, vsFTPd and a chrooted user in a specific directory where the file resides. I think this is pretty save as long a nobody else uses my FTPclient. How can I make changes to this file on the remote server from within my php-code on my webserver ?? (so that not I need to make the changes but my users can do it from a html-form) I found this but the credentials for the FTP-connection are plain :

<?php
$file = fopen ("ftp://loginasswd@server", "w");
if (!$file) {
echo "<p>Unable to open remote file for writing.
";

[code].....

I use https for the webGUI, but I guess this does not mean the connection to the remote server will be encrypted also ? Can I use my FTP-user (has no shell) from within php to edit the file ?

View 12 Replies View Related

Programming :: Connection Refused In Client Server Program

Oct 23, 2010

I wrote a simple client server socket program in C.

View 1 Replies View Related

Programming :: Global Or Server Variables - Array Connection Oriented

May 20, 2011

I have a general question regarding php. Suppose that I want to have an array that stores connection-specific data, that can be anything IP address or something similar. However, whenever I use global or server variables (i.e. GLOBALS or _SERVER) the array created in this way is kind of connection-oriented, so that for each connection there is a separate instance of this array. Maybe it has something to do with the MPM of Apache, but I am not sure. Is it possible to implement an array that stores information about all connections that are at a system? In this way, each connection can chip in and upload it with data? Also, I would rather not use cookie's.

View 3 Replies View Related

Programming :: Write A Bash Script To Time Some Downloads From A Server Using Ftp Connection?

Jun 8, 2010

I write a bash script to time some downloads from a server using ftp connection. ( something like: "time ftp 'options' ) I need to count the time for a list of files in a loop and output the result in a file.

View 1 Replies View Related

Ubuntu Networking :: Samsung Mobile Modem Not Detecting When Connecting New Mobile Broadband Connection?

Oct 17, 2010

i am using samsung S3310 with aircel when i am connecting new mobile broadband connection my device is not identifying ,so that i cant connect Internet.but everything okay i mean settings in mobile and pc. for same connection i used Nokia mobile its identified and Internet was connected but samsung mobile is not identifying in terminal i typed LSUSB my device is shown in that.

View 9 Replies View Related

Programming :: Detecting Newly Created Folders / Files On Local File System?

Apr 16, 2010

Using C++, I want to process sub-folders on my home folder sequentially each with a special naming format and containing some binary files in it:

Code:
1/
2/
3/
4/
5/
6/
...

Give above folders, I will process files in 1/ at first, 2/ at second, 3/ at third, and so on.

For some n/ folder, if I realize that n/ actually does not exist in local file system, I do not want to wait for it. Hence I will keep processing (n+1)/ folder, and so on.

However, when processing some (n+m)/ folder, previously not processed n/ folder may have been created on local file system. In this case, I do not want to miss processing it, but somehow detect its creation and process it. After processing n/ folder, I want to continue from (n+m+1)/.

View 5 Replies View Related

Programming :: Ajax To Open An Ftp Connection - Download A File And Then Turn Around And POST It To A Web Server?

Jun 23, 2011

just curious, this might not be possible, but is there any way with ajax to open an ftp connection, download a file and then turn around and POST it to a web server? the reason i ask is because i'm writing a script on a shared hosting plan that doesn't give me permission to directly talk outbound on the ftp port but i need to synchronize a file from a csv on an ftp server, this means i have to do the process manually, is there any way i can just click the button and let my browser do the work?

View 4 Replies View Related

General :: Lpq Printer 'sdst@other.domain' - Cannot Open Connection - Connection Timed Out Make Sure LPD Server Is Running On The Server

Mar 23, 2011

Linux printing appeared to be working fine up until yesterday. Today typing lpq gives the following: lpq Printer 'sdst@other.domain' - cannot open connection - Connection timed out Make sure LPD server is running on the server

The /etc/cups/printers.conf file is properly set, the printers appear in localhost:631 and they are printing test pages. However, all command line print commands seem to be trying to print to sdst@other.domain I don't know why printers.conf is being ignored and why and how sdst@other.domain was added. Seems like it might have been auto-discovered?

# dit: sdst@other.domain was mentioned in /usr/local/etc/lpd.conf I'm not sure why lpd.conf is being used instead of /etc/cups/printers.conf

View 1 Replies View Related

OpenSUSE Network :: Internet Connection Is Broken

Aug 10, 2010

Dell Precision Workstation running Suse 11.1 & KDE 3.5 as default O/S, with Suse 11.3 KDE4, Ubuntu 10.04 & Win XP Pro as secondary O/S's.Medion PC with Win XP Pro for those windows apps I have to use (against better judgement but because my clients require it!)

On Friday 6th I was having a play with Apache2 running on the Dell Precision on Suse 11.1. I have had a local development webserver for some time to test websites before uploading them a host server. I had wanted to test the DHCP & DNS functions for some time, and this seemed like a good opportunity. But I ran into some problems and decided to un-install the DHCP & DNS. I intended to install a VM and re-install the Apache server on it, to make it easier to troubleshoot.Unfortunately my internet connection on that box is now broken, but only with the Suse 11.1 install. The other 3 O/S's all work fine, and the rest of my machines are all good. In fact the Suse 11.1 install can communicate across the LAN, and print to both the network printers, it just won't connect to the Internet. Turning off the firewall doesn't do anything, and reconfiguring the NIC in YaST doesn't help.

I suspect that there is a config file somewhere with faulty info, but I can't find it. If searched everything that was changed on that date.I have been searching this forum, LinuxQuestions forums, and Googling for 2 days with no real success. I found some interesting threads which I thought would help but so far no luck. I can ping all the interfaces on my LAN, but anything outside is blocked. I thought it might be in the BT HomeHub but that works fine and all the boxes can connect except with the Precision running 11.1.

View 4 Replies View Related

General :: Resume RSYNC Over SSH After Broken Connection?

Jun 27, 2011

I have to transfer large amounts of data (>80 GB) over ssh using rsync. Everything is working fine, but the DSL connection where the backup data is sent from will drop once every 24h for up to 3 minutes (switching providers is not an option).

How do I:

Automatically restart the transfer when the connection is back up? Make sure there are not by accident two rsync commands running at the same time?

View 1 Replies View Related

Ubuntu :: 10.10 - Broken Wired Connection After Reboot

Nov 27, 2010

I just installed 10.10 on a desktop machine, dual boot with Win XP. Everything went well, it connected and did all the system updates etc. Then one time I rebooted and it wouldn't connect. I've tried rebooting again several times, tried unplugging the modem/router from the power and from the computer then reconnecting everything and starting it up again, no joy. I booted from the Live CD and it connects without any problem, likewise from Win XP. My Network Connections shows 'Auto eth0' and below is the ifconfig output.

Code:
jim@ubuntu:~$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:13:8f:b8:ad:fc
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:42 Base address:0x6000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:240 (240.0 B) TX bytes:240 (240.0 B)

View 1 Replies View Related

Ubuntu Security :: Vnc/ssh Server Behind Nat - Detecting Real Ip?

May 29, 2010

broadband cable -> Linksys RTP300 router -> Firestarter -> Ubuntu 10.04 Desktop

sshd and vnc installed and working fine when enabled but the only way is to add my routers ip as a trusted address or add individual port entries for 192.168.15.1... on the linksys i, of course, have the appropriate ports forwarded to the Ubuntu static ip, so basically anyone can try to connect... how can i make the router forward the internet ip of the person trying to connect, so I can lock it down better?

View 8 Replies View Related

CentOS 5 Server :: Amavisd Not Detecting Viruses?

Feb 8, 2010

I have postfix setup with amavisd and I tried to send myself an email with the eicar file however it lets the email go through to my inbox. When I restart the amavisd service, there are no errors in the log and it finds all the decoders for different file types and I also see this come up:

Feb 8 14:45:44 Mailgate amavis[3116]: Using primary internal av scanner code for ClamAV-clamd
Feb 8 14:45:44 Mailgate amavis[3116]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan

Everything seems to work but it doesn't scan the file for viruses. Also, I've double and triple checked and my amavisd.conf file doesn't have the option enabled to bypass virus scanning.

View 5 Replies View Related

Hardware :: Fedora Core 5 On Server - Detecting Network Card?

Jul 11, 2010

Here comes my problem: I am installing a new unit with Fedora Core 5,I will use it as my internet server. I need one additional PCI network card but it is not detected during installation.what shall I do?

View 5 Replies View Related

Server :: Connection Sharing Feature - Shared Connection To Server Closed

May 20, 2010

I'm a frequent user of the shared connection feature of SSH. Usually i have two or three connections open at the same time through the connection sharing feature, but sometimes when i try to start another i get the message "Shared connection to <server< closed". All the connection that are established through the connection sharing feature are still active and not closed, but when i try to create a new one i get that message.. i've even got that message when i have only had two connections through the shared connection feature.

I've tried to search google but it doesnt seem like anyone else has had the same kind of problem, does someone know why i sometimes get this error ?

View 1 Replies View Related

Ubuntu Servers :: 10.04 Dell Poweredge 2600 Server Locks Up At 94% On Detecting Network Hardware?

Oct 31, 2010

So basically what I am trying to do is install Ubuntu 10.04 on a Dell Poweredge 2600 server. Right now I dont care wither I get the server version or the desktop version, I just need to get it on their. this is what I have run into. When installing the regular Ubuntu 10.04 desktop for 32bit, the server just locks up on the very first ubuntu install screen and the keyboard lights just start blinking non stop. When I use the server version, the server get to the Detecting Network Hardware and locks up at 94% and the keyboard will also start blinking nonstop. I have looked all over for an answer to this problem and have yet to find one. This guy figured out how to make it work but he never mentioned what version he was using. [URL]..

On this server I have 6 HDs, 5 of them are RAID 0 with 1 Hot Spare. I have also tried using the ubuntu-10.04.1-alternate-i386.iso.torrent and still had the same problem. I have spent the last 3 days searching all over google and the forum to an answer but had no luck.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved