Programming :: Detect A Closed Tcp Client Connection When Client Is Only Receiving Data ?
Mar 9, 2011
I am writing a TCP server in C, and the server listens to incoming client connections and accepts them. It then creates a thread to handle the client. The clients are expected to only receive data from my server and not send any data. So if I use a select() call with a recv(), I believe that the recv() will just block forever since there will not be any data coming from the client. If I use a non-blocking recv(), then this will just return a 0 which tells me nothing because the client is not expected to send any data. I am not sure if I have misunderstood some socket concepts, but I need a solution to detect when the client has disconnected so that I can close the socket and stop sending data to the client. As I understand it, simple ACKs etc are not captured by the recv(), and only data sent by the client will cause recv() to return a non-zero value, so I am not sure how to know when the client has disconnected.
View 7 Replies
ADVERTISEMENT
Aug 6, 2010
Reading some examples on net and copying some codes I was able to build a (frankstein) server that accept connection from one client and receive and send messages to it. The big problem that shows up is that I don't know when client disconnects from my server.
I've been looking for a solution, but no success. I'd read about SO_KEEPALIVE option (which could solve my problem), but I don't know how to use it (how to check the value of it).
I can't use ping because the server (machine) could be running, but not the client (software).
Anyone knows a good tutorial or how to (for beginners like me xD) of TcpIp sockets using c/c++ and how to detect when a client disconnect?
I don't know sockets very well.
View 6 Replies
View Related
Mar 8, 2011
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]....
View 3 Replies
View Related
Jun 3, 2011
I have a question today: "How to detect client use Sock or Proxy?"Note: I hope everyone serious discussion.
View 1 Replies
View Related
Aug 17, 2010
I am using a simple javascript to connect my flv streams with Red5 (streaming server) every thing is working perfectly fine in Mozilla and Chrome.
But when it comes to IE it simply wont load the player.
Here is my script code...
How do I detect the client browser and redirect him to adobe flash upgrade page if the client browser does not have a supported player?
View 4 Replies
View Related
Feb 16, 2011
If you have a proxy and receive/send data from/to both the client and the server,is there a way to test what part has data to send(client or server) ?
View 1 Replies
View Related
Mar 8, 2011
I have a server listening on incoming client connections. Once the client establishes SSL connection with the server, the server waits on read() from the client. Only Client can disconnect the connection. I want to have a timer in the server program to wait for x secs after read() and then disconnect the Client connection.
View 3 Replies
View Related
May 14, 2009
I have to implement a client/server solution that pretty much does this:
1) Client broadcasts UDP packet;
2) client receives answer packet from multiple servers - it includes the TCP port to use next and a list of files;
3) user picks file from list;
4) client downloads from server via TCP.
I got the client to broadcast and the servers reply. However, i'm not yet getting the client to be able to receive multiple packets.
I'm very inclined and have tried to implement select, but most examples i find are for stream sockets. Once the fsSet shows a read event would i create a new socket or just use the main socket for recvfrom()ing? I assume i need at least two sockets. However i'm not sure if this will allow the client to actually receive simultaneously... so i'm kinda not wanting to guess that this implies fork and threads... Also, i assume the socket must be nonblocking (done), although i've read somewhere select would take care of this?
View 3 Replies
View Related
Oct 23, 2010
I wrote a simple client server socket program in C.
View 1 Replies
View Related
Apr 30, 2010
I need to ask about some method let me to subscribe to some one who make satellite sharing by some file and cable attached to the Receiver to let you receive the stream of codes that he send
View 3 Replies
View Related
Nov 13, 2010
I would like to play .mp3 and .mpeg files with Red Hat Enterprise Linux 6 Client. Flash and Java must also be working. For Java, I have download the jre-6u22 and the jdk-6u22 and installed manually. How can I get automatically updates for them? For Flash, I have installed the i386 package and the .repo so the updates must working. So, I have
Code:
/etc/yum.repos.d/
adobe-linux-i386.repo
atrpms.repo
epel.repo
epel-testing.repo
mirrors-rpmforge
mirrors-rpmforge-extras
mirrors-rpmforge-testing
packagekit-media.repo
rpmforge.repo
rpmforge.repo.rpmnew
rpmforge-testing.repo.rpmsave
rpmfusion-free-updates.repo
rpmfusion-free-updates-testing.repo
rpmfusion-nonfree-updates.repo
rpmfusion-nonfree-updates-testing.repo
[URL] hasn't RHEL6 yet.
Enabled are only Adobe, RHEL Client v6 for 64-bit x86_64 and the RHEL 6Client - RPMforge -dag repositories. The others make problems with dependencys. RPM Fusion has no EL 6 repos, so I deactivate them. I have chosed to install the gstreamer plug-ins bad but haven't find them. Manually download from rpmfind or pbone results with wrong depencies...it's horrible.
View 3 Replies
View Related
Feb 17, 2011
There is a segmentation fault error while receiving http request side program. Following is the code:
Code:
#include<iostream>
#include <sys/types.h>
[code]...
View 1 Replies
View Related
Aug 10, 2009
When DNS server is configured on Windows server, it will automatically detect and catch computer names and IP address. With Linux (BIND), I have to enter each clients manual under zone file. example (computer1 IN A 10.10.1.4). is there anyway to make Linux detect client automatically as windows does?
View 6 Replies
View Related
Jan 6, 2011
trying to create a "local network" by directly connecting an IBM Thinkpad with Debian Linux installed on it to an Alix computer running Voyager Linux. I'm following a "how to" I found to create a music server, hence the requirement. My issue is I can't get a static IP address to be configured on the Debian machine.I've trawled the net and have found the instructions about editing the /etc/network/interfaces and have tried to do this. First I tried to get DHCP working so I could connect the Debian machine to the net and this proved successful. I edited the interfaces file to look as follows:
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
Then I tried adding a static IP address to the machine. As this is a network purely between two machines I made up the IP addres and used 192.168.0.1 and used a NetMask calculator to give me a NetMask of 255.255.255.254 (I told the calculator there would be 2 machines on the network). I then edited the interfaces file as follows:
# The loopback network interface
auto lo
iface lo inet loopback
[code]....
I re-booted the machine (ifdown eth0 followed by ifup eth0 keeps saying that eth0 hasn't been configured - a problem there that I don't understand), but during boot up time it failed to assign the Static IP address to eth0 and made me go into SU mode. To fix it I simply replaced the interface file with the static IP inputs with the file that had the DHCP entries (I'd made a copy of the DHCP file), and re-started the machine. Everthing came up fine. So the first question is how do I get a static IP address to be assigned to eth0 such that whenever I shut down and restart the machine the static IP address is always loaded?
The second question is around creating the network via the cross over cable. From what I've found via Google, all I should have to do is create a static IP address on the Debian machine and a static IP address on the Voyager machine. Once they're connected by the cross over cable they should see each other. Is that correct, or do I have to do anything else?
View 2 Replies
View Related
May 26, 2011
I have configured server ubuntu 11.04. Everything works fine, but there is a need for some clients to connect local hard drive. What should I do? How and what modules are added to the ltsp-image? How to register in the fstab on the client? Maybe I'm going the wrong way?
View 1 Replies
View Related
Jan 28, 2011
currently I've got a big problem on programming with sockets. I use the winsock2 API and want to receive data from a multicast adress running on a UNIX-PC. The connection works fine and I really receive data from this group, but as it seems not the right packages. The received data is saved in a char[]. E.g. at received_msg[12] is a float value. This one I would like to read out, convert and use it in later progress the next value is y at received_msg[16]. The same Code works on a Unix PC with unix sockets but converted to winsock I've got the described problem and I have to make this code work under windows.
Here a piece of the code (received_msg[12]='3f'):
Buffer is a struct containing the two float values x and y. If I convert the char as this under windows the value of x is a huge number. The correct value is around 192, so receveid_message[12] should be 1.92. Could it be that the Unix-PC is sending data in an other way than the winsock receive it?
View 2 Replies
View Related
Nov 25, 2009
Is there a good terminal services client available I can connect to my Windows boxes from Fedora12? I am willing to pay for a commercial license if there is a good one
View 7 Replies
View Related
Jul 9, 2010
i have server and client, my client is sending data of 100 bytes at a time but server side i am receiving 50 bytes once and in next iteration i am calling recv function for receiving remaining 50 bytes but the receive is blocked it doesn't reading any data? Does any body have a idea let me know
View 1 Replies
View Related
Jan 1, 2010
Is there a way to download any kind of files, if i have the url, with a bittorrent client? I've seen this feature in Bit-comment and i like it. So is there any similar thing for linux? Update: Im not asking how to download bittorrnent files, what i want is to download any file (that can be downloaded within any webbrowser) with a bittorrent client.
View 1 Replies
View Related
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
Feb 9, 2010
i have installed nfs server on my redhat machine.when i want to mount shared data from client(suse)machine the following error occur. "mount.nfs: mount to NFS server '10.3.31.146:/home/usbtest' failed: System Error: No route to host" both machines ping each other successfully.
View 1 Replies
View Related
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
Dec 13, 2010
I have a number of Ubuntu machines running. Our NAS is FreeNAS. I am typing this on an Ubuntu 10.04 desktop that is successfully connects to an NFS share on the FreeNAS box every day. In addition, we have 3 10.04 server machines that also stay connected to the share successfully, Yesterday, I installed a new 10.04 server machine using IP 192.168.0.11. Everything works except connecting to the NFS share. It always returns with: mount.nfs: mount to NFS server '192.168.0.13:/mnt/amrd0s2/public-NFS' failed: timed out, giving up
Here's what I have checked: I can ping 192.168.0.13 (obviously) The NFS export mask is set to 192.168.0.0/16. The other machines are all on the same subnet as this problem machine (192.168.0.*) nfs-common, nfs-client, and portmap are all installed and running correctly. portmap is running correctly showmount -e 192.168.0.13 give the proper response:
Export list for 192.168.0.13: /mnt/amrd0s2/public-NFS/ 192.168.0.0 iptables isn't even installed (these machines are segregated in a private network behind a hardware fire all) There is nothing related to NFS is any of the syslogs. dmesg has one entry: [6.025966] FS-Cache: Netfs 'nfs' registered for caching which is insignificant. how to at least debug the nfs-client short of downloading the source and actually stepping through the code.
View 1 Replies
View Related
Jan 30, 2011
I'm having problem running open SSH. I have installed SSH, on my system, but when I run:ssh localhost.I get the error :Read from socket failed:Connection reset by peer.I get that same error when trying to connect from a different local computer.When I attempted to restart the service by typing: sudo /etc/init.d/ssh restart.I proceeded to generate a new set of keys by running, ssh-keygen -b 1024.But I get the same errors after doing so.
View 1 Replies
View Related
Dec 29, 2010
I am getting tcp client connection refused error, when trying to establish tcp client connection from redhat linux to solaris unix. Connect system call is giving connection refused error
View 3 Replies
View Related
Feb 9, 2010
I am using redhat on server and open suse on client. When I want to ssh from my server machine the following error occur "connection refuse". I execute the following command on clien machine "/etc/init.d/sshd start". It shows the following error just after command execution "sshd re-exec requires execution with an absolute path".
View 1 Replies
View Related
Jul 14, 2010
What is the best client application for connecting through PPPoE (DSL connection)? Gnome's default network manager isn't very useful. I created a DSL connection but don't know how to use that.
View 1 Replies
View Related
Mar 22, 2011
I was wondering if there was a way to connect over ssh "backwards". For example, lets say there's a client connected to example.com via ssh from behind a router. Well you wouldn't be able to ssh to that client unless the proper ports were forwarded on the router right? So I'm wondering if there would be a way to connect to example.com through ssh then from there connect to the client using the already existing ssh connection.
View 4 Replies
View Related
Jan 30, 2009
I have an ubuntu 7.10 ICS server that works fine and I have routed my traffic using firestarter to my windows PC. my server's IP is 192.168.0.1 and my windows client is 192.168.0.2. now, I have bought another PC and I want to assign 192.168.0.3 to it and connect it to ubuntu server. in windows, all I needed to do was to connect the first client to first network card, second one to second network card, bridge two connections in my server, assign 192.168.0.1 to the network bridge in my server and 192.168.0.2 and 192.168.0.3 to my clients, then share my internet connection. I also could access shared files in any computer from all of them. can I have the same functionality with a linux server?
I'll make a list to make it easy if you don't wanna read the whole post:
things I want:
1. assign one ip address to multiple interfaces in linux, making them bonded.
2. sharing the internet connection with both clients.
3. ability to use all shared files over a network.
View 4 Replies
View Related
May 14, 2010
I am trying to Setup citrix ICA client 9 on Ubuntu 9.04 Server. I installed it very easily and I am not getting any lib error also. But when I try to connect to the citrix server, it fails with a pop up saying "Error in Network Connection Network or Dialup connection may be preventing ......" This is driving me crazy from 3 days. My project is to check the feasiblity of a Linux desktop
View 1 Replies
View Related