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


ADVERTISEMENT

Networking :: Sending / Receiving Data Simultaneously Using BSD Sockets

Jun 25, 2010

I would like to send a data using one thread and receive a data using other thread by using a same socket connection using USD sockets. The calls i am using for sending and receiving are send(), recv(). let me know is it possible to send and receive the data parallel (Full duplex communication)?

View 2 Replies View Related

Programming :: Sending Binary Data Through Sockets In C

Nov 29, 2010

I am coding a http server which has to send the file(s) such as images, .avi files, .mpeg, that the client is going to request. I have been trying of sending files through sockets.

char info [256];
bzero(info, 256);
//memset(&info,0,sizeof(info));
read(socket, info, 255);
write(socket, HTTP, 255);
FILE *fl= fopen(info,"rb");
fseek(fl, 0, SEEK_END);
long len = ftell(fl);
printf("largo: %ld", len);
unsigned char *ret = (char*) malloc(len);
fseek(fl, 0, SEEK_SET);
fread(ret, 1, len, fl);

However, it's supposed to be shown in Mozilla Firefox (as the client). But it is not doing it, so.. It's just not getting the complete file.

View 1 Replies View Related

Networking :: Sending Frames Of Size 1518 Using Raw Sockets

Aug 19, 2010

I wrote an application that receives packets on one interface and sends them to another interface after it added a vlan header. Both the sending and the receiving is done using raw sockets. Everything seems to work fine until I get TCP packets that are of size 1514 (MTU). Once I add a vlan header to the packet, its size becomes 1518 and when I try to send it I get the returned value -1 and errno=90 (message too long). I tried to change the MTU of the NIC to a value that is bigger than 1500 but that fails. If I create a bridge using brctl and vconfig between the NICs I can see that my NIC does sends packets of size 1518. What do I need to in order to make my NIC to send packets of size 1518?

View 5 Replies View Related

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 View Related

Server :: Postfix And Amavist - Lost Connection While Sending End Of Data

May 24, 2010

Since today morning we are getting this error, could not track down the cause

We are running :
Postfix
Amavist and Clam

70A6C45A1CE: to=<actualemailid@yahoo.com>, relay=none, delay=0, status=deferred (delivery temporarily suspended: lost connection with 127.0.0.1[127.0.0.1] while sending end of data -- message may be sent more than once).

View 6 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

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

Networking :: Rsync Sending Data From The Client To The Server?

Jun 29, 2010

shed some light on what I am doing. I am wondering if I just havehings back to front.Server (MESH):Fedora 13Firewall ports open tcp 22(ssh), tcp 873(rsync)sshd service started

View 5 Replies View Related

Networking :: Sending Raw Data To A USB Device From Terminal In Ubuntu?

Jan 25, 2010

I want to send raw data to a usart port of my board connected to linux box. i know the command

echo "abcxyz" > /dev/<usb_dev_file_name>

would write the raw bits for characters abcxyz to the usb device but the problem is how do i know which device file to write to?there are so many in my /dev.

View 1 Replies View Related

Networking :: Sending Test Data From File To Port And IP

Apr 23, 2009

I'm working on testing some software, and I have a question. We have several files of binary data that we need to push through our application to test. It communicates via simple TCP sockets. Is there a way I can send this data to the socket from the command line? I tried doing something like this, but telnet never picked up the data.

View 5 Replies View Related

Networking :: Socat - Sending Binary Data From Client To Server

Apr 15, 2010

I am trying to redirect connection to port 8980 to execute a telnet command to a local machine
by issuing the following command :
In Server 1 :
socat TCP-LISTEN:8980,fork EXEC:/myscript,reuseaddr

My script contains
#!/bin/bash
telnet 192.168.20.12 //local Server 2

I am sending Binary data from the client to Server 2 via Server 1. So it happens that I have some characters in Hex translated to special characters in ASCII like open brackets or Commas etc.. and that closed the socket between the two machines.

View 2 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 :: Parallel Data Transfer Using Sockets

Feb 25, 2011

I am doing a project where 2 clients connect to server and communicate (chat) and transfer data one after other using sockets. I have working code for this in C language. Now our main aim is to create a communication link where two clients transfer multiple streams data parallely. To be more precise i want to transfer images files and audio files parallel at same time, so is it possible to send data parallel using one socket connection?

View 3 Replies View Related

Programming :: Automated Monitoring Of Different Sockets For Available Data

Feb 4, 2011

NextPendingConnection () returns a new socket with respect to a new client. This new QSocket is passed to the connect () function which connects it to a SLOT 'xyz' with SIGNAL 'readyRead()'. Now in the SLOT 'xyz' how I am supposed to automate the monitoring of ALL connected sockets to see whether some data is available on them? One pathetic way would be to run all the sockets through a for loop and check each one of them for the data. Secondly, I read up on QSocketNotifier() here: [URL]. But I am not sure if that is the correct thing.

View 3 Replies View Related

Ubuntu Servers :: Setup On Non Web Mostly Data Based Via Sockets

Jan 24, 2011

What ubuntu server setup will work the best on a non web mostly data based via sockets (mysql php phpadmin) will be the easiest to use and what sockets to use? Lamp?

View 1 Replies View Related

Programming :: Add Local Sockets In Multi-threaded Application In Order To Exchange Data Between Threads?

Jul 24, 2010

I'm trying to add local sockets in my multi-threaded application in order to exchange data between threads. The only problem I got is that most of the information available on the net is related to internet oriented socket programming whileI want to perform local connections. got a thread that does the sniffing via libpcap. And I would like that thread to send each captured packet to a second thread that will analyse the packetof the thread implementations is written in separate .h file.Or maybe there is a more effective method of exchanging data between threads

View 14 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 :: Sockets - P2 - P3 Http Connection Taking More Time Than The Expected?

Mar 31, 2011

Iam using socket programming in one of my problem. The scenario is like this.

=>one module is working as a socket server(process p1) is able to handle client sockets on that port.
=>one module is working as socket client (process p2) is connected to server socket and Tx/Rx data on this socket. This module has some more threads, based on received data from server socket it will connect to http on other thread and get information...
=>one more module is working as socket client (process p3) is also connected to server socket and doing some other transactions.

Here my problem is when in presence of p2, p3 http connection taking more time than the expected. If we wont start p3(means only one server-client socket) then http connection is fast enough.

View 1 Replies View Related

Ubuntu :: Evolution Broken - Error While Sending Message

Oct 18, 2010

Just upgraded to 10.10, evolution worked the first time but has not worked since. Have tried re installation but no joy. Starting for terminal shows:-
(evolution:16876): Unique-DBus-WARNING **: Error while sending message: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
It was working in 10.04.

View 3 Replies View Related

General :: USB Data Card Is Not Detecting In 2.6.36 Kernel

Jan 10, 2011

I am using a linux FC-12 machine which is running on 2.6.36 kernel. I wanted to use the USB data card with that machine. But it is not detecting the device. I found that the modules usbserial, option, qcserial were missing. I installed them using "insmod".After that I have removed and reconnected the device. Still the OS is not detecting the device.After the reboot of the machine, again the modules related to USB are missing.

View 2 Replies View Related

Server :: Bash Scripting Sending Write Error - Broken Pipe

Apr 19, 2010

I move a page from a server in SuSe to Debian and this script was working well but when I move the page to a Debian base server it is sending in the logs the following message:

cat: write error: Broken pipe, referer: [URL]

The cgi does the following, read a db file plain text that repeat each 15 lines an information where to look the seraching info. if it is there sends to the output the 15 lines block. but it was not sending errors in suse distro, does anybody knows why the cat's line are sending "cat: write error: Broken pipe," if I am not writing or making a pipe with ">" to none file.

View 8 Replies View Related

Networking :: Received Data - RX - Errors And Very Slow Connection

Jun 22, 2010

I have a Webserver (Co-Location) and all runs fine ... since last week. Now there are a lot of RX-ERR shown in netstat and ifconfig. And when I try to upload a external website direct on the server for example via wget, it is very very slow and hangs very often.

RX packets:2919694 errors:990386 dropped:0 overruns:0 frame:596420
TX packets:4231423 errors:0 dropped:0 overruns:0 carrier:0

I have analyse the network but I was not able to find a problem. My hoster has checked the network and all looks fine. For example my hoster has plugged-in a pc in the same switch ... and was able to do wget (load external data, like websites) in normal speed.

Since last week my websites were delivered slower as before, too. It seemed there is a network-problem ... but how can I find it?

Actually I can install moduls ... but the server needs hours. So, if you knows a good command-line tool to analyse the network.

View 1 Replies View Related

OpenSUSE :: Bluedevil - Sending Data Failed From Computer?

Apr 13, 2011

I have a question regarding Bluetooth with Bluedevil. Finally I got a connection working in one direction: sending files from my mobile (Google Nexus One with Android 2.3.3) to the computer. But I can not send files from my computer to the phone. I also tried to send files from my desktop to my Laptop and it fails. I also tried it the other way around: from Laptop to Desktop... fail.

What is it? Is it still a bug in Bluedevil and all I can do is wait? Or is there some package missing? The following packages (regarding bluetooth) are installed:

bluedevil
bluez
libbluetooth 3
pulseaudio-module-bluetooth

I don't believe that it is hardware related, because it works one-way... If I should post logfiles or whatever.

View 9 Replies View Related

Programming :: Sending Binary Data To Bluetooth With Terminal

Aug 30, 2010

I am using centos 5, want to send a sets of binary data to other bluetooth device I know how to sent a file but dont know how to sent raw data. My case is like this I have a bluetooth device I need to send data to then after it process I need to get it back, I plan to do this all using terminal is that possible?

View 2 Replies View Related

General :: Find Soundcard Used By Alsa For Sending The Data?

Jun 1, 2011

I have slackware 13.0 installed in my system. how to find soundcard used by alsa for sending the data.

View 1 Replies View Related

Programming :: Extract Data By Sending Queries To A Website?

Dec 17, 2010

What would be the best way to extract data by sending queries to a website?

View 2 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

Fedora :: Finding Out What Processes Sending / Receiving Network Data?

Oct 27, 2010

I have a desklet that, occasionally after toying with network stuff, will tell me that large amounts of data are being sent/received. What's a good way to determine what processes are occupying these resources?!

View 14 Replies View Related







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