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


ADVERTISEMENT

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 :: 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

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

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

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

Ubuntu :: Rsnapshot - Automated Data Backup Of Remote File System

Aug 28, 2010

Rsnapshot is a software written in Perl to make backup of local and remote file system. The well proven rsync is behind this utility. rsnapshot does not need root user intervention to restore the data of a normal user. It does not take much space in your Backup server. It can be easily automated (scheduled) to make life easier. Just setup once and forget it configuration. Basically it takes snapshot of file system (or a part of) in regular interval such as hourly, daily, weekly and monthly.

This can be configured easily through a simple text based configuration file. The above task can be setup in a few easy steps in a few minutes. Two major tasks are configuring rsnapshot and openssh automatic login. To make the backup automatically, we need to automate the remote login in a secured way. This can be done through openssh tools. This scenario depicts backup of desktop (assuming that IP address is 192.168.0.100) data to a backup server. My desktop runs on Ubuntu 10.04 and backup server runs on Debian Squeeze. [URL]

View 2 Replies View Related

Security :: USB Theft Monitoring In The Data Center?

Nov 7, 2010

have around 20-30 HP and Dell Hardware where we have attached Pen Drive. There is no Rack-lock facility. A misuse of Pen Drive is reported and it happens every alternative day that someone unplug and theft the drive attached.There is no camera facility to monitor.I have a plan to write a script which will login to every machine through ILO and watch the USB availability. In case anyone dettach the USB, a mail will be sent to the administrator and thereby the steps could be taken.Does this idea look feasible.

View 13 Replies View Related

Programming :: PING Using Raw Sockets In C?

Nov 18, 2010

Is there any way to implement a simple ping script in C (unix)? I'm programming simple OpenWRT scripts.

I have found some examples of ping in C:

[URL]

However, nothing happens, nothing is sent.

When I look at the code, in the portion where the socket is created, I can see that the socket is not binding to any interface:

Code:
if ((sockfd = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) == -1)
{
perror("socket");
exit(EXIT_FAILURE);
}
setsockopt(sockfd, IPPROTO_IP, IP_HDRINCL, &optval, sizeof(int));

Instead, it uses "setsockopt" to set some options.

My guess is that it is trying to send packets over the eth0 interface instead over the wl0 (wireless) interface (which is the one I want to use to send pings).

Now, my question is: Is there any other way to send pings in C by binding to an interface?

View 1 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 :: How To Use Sockets To Display GUI At Server End

Aug 27, 2010

I am struggling a little on how to best approach this problem. I have wrote a server program that runs via xinetd, that obviously spits out data at the client end. Fairly straightforward stuff?There is a point in my server code where I need to display an image/gui i.e something that runs on X11 that prompts a user to perform a task on the display connected at the the server side.So far I have written a test program that displays some text at the client end and then launches the browser at the server end. I have also set the following export. Code: export DISPLAY=:0 and then goes on to launch my web browser. Works great when ran locally on the server and when I remotely telnet in to the server and run the code.

However when I try to run the same piece of code as a xinetd service the export seems to have zero affect and the client terminal window displays errors associated with there not being a X11 server running.The code launches fine when I create a socket to serverip:6556 it just the ability to display gui programs to another display that does not seem to be working.

View 5 Replies View Related

Programming :: Send A Packet Through Sockets C++

Feb 1, 2011

Can someone help me with this problem,trying to send a packet,using tcp/ip,the packet should look like this:

Code:
field 1: SOCKS protocol version, 1 byte (0x05 for this version)
field 2: status, 1 byte:
0x00 = request granted
0x01 = general failure
0x02 = connection not allowed by ruleset
0x03 = network unreachable
0x04 = host unreachable
0x05 = connection refused by destination host
0x06 = TTL expired
0x07 = command not supported / protocol error
0x08 = address type not supported
field 3: reserved, must be 0x00
field 4: address type, 1 byte:
0x01 = IPv4 address
0x03 = Domain name
0x04 = IPv6 address
field 5: destination address of
4 bytes for IPv4 address
1 byte of name length followed by the name for Domain name
16 bytes for IPv6 address
field 6: network byte order port number, 2 bytes
and this is my code:

Code:
int domainLen = strlen(domain);
char reply[domainLen + 7];
reply[0] = 5; // version
reply[1] = 0; // succed
reply[2] = 0; // reserved
reply[3] = 3; // its a domain
reply[4] = domainLen;; // lenght of domain
for(int j = 0; j < domainLen; ++j)
{
reply[j + 5] = domain[j];
}
reply[5 + domainLen] = 80; // port
reply[20] = '�';
Send(reply, sizeof(reply));
domain is "www.google.com". Am I doing it right ? I dont know much about bits.

View 6 Replies View Related

Programming :: Creating 2 Sockets In Client / Server?

Jun 9, 2010

I have a problem creating my second socket in client file. the program was running well but when I try to add another socket to connect to the same server, I got a problem connecting to the first socket! it doesn't make sense. the original code was:

sockfd[i] = socket(AF_INET, SOCK_STREAM, 0);
if(sockfd[i] < 0) error("(MAIN) - Error openning socket 1");
port_num[i] = portno;
bzero((char*) &serv_addr[i], sizeof(serv_addr[i]));

[Code].....

View 1 Replies View Related

Programming :: Read DNS Informaton Using Sockets And C Libraries

Jun 9, 2010

I am using the API libpcap in order to filter the traffic of the port 53 from my PC ro other PCs, in other words the DNS traffic.I want to get more information about the DNS traffic that is being sent to the DNS server, in other words the queries. So far I have no idea how to read the information data or payload of the UDP package in order to read the content of the traffic for example if there is any PTR, A, MX, etc Resource Record.According to the RFC 1053 there is a header that is possible to use in order to easily get this info.

View 5 Replies View Related

Programming :: Automated Ftp Download Of File With A Name That Changes

Apr 30, 2010

I am trying to create a script to do the following.. Login to a ftp and download a with the following naming convention xmtvMMDDYY.xml.gzon a daily basis followed by extracting that file. which I can do easy enough with a static filename. but the variable filename is throwing me off. I was planning on doing a mget with wildcard to just grab the entire directory but this found to not be as clean as I had hoped. Mainly due to the admins of the ftp keeping multiple days of the above mentioned file on the site.

View 2 Replies View Related

Programming :: Toolkits To Do Automated GUI Testing?

May 13, 2010

I am involved in a project where some regression tests are to be automated. Could you please tell me what are the testing tools that are available for doing automated GUI testing in Linux?

View 2 Replies View Related

Programming :: Possible To Pass File D Escriptor Without Sockets / Streams?

Apr 20, 2010

I have a problem passing a file descriptor from one process to another.

I have two processes A and B. Both are running in different network and
filesystem namespaces, so it is impossible to use unix domain sockets or
net sockets to pass a file descriptor from process A to process B.

The usage of STREAMS is also impossible, as you can see in
fixunix.com/unix/84093-streams-pipes-ioctl-i_sendfd.html

[quotation begin]
Linux doesn't have STREAMS, which are the System V way
of doing this task. ...
[quotation end]

Are there additional possibilities for file descriptor passing like
using named pipes or something like that or does anybody know
a good workaround for this problem ?

View 9 Replies View Related

Programming :: Closing Multiple Client Sockets In Server ?

Nov 30, 2010

I have written a server application which has select for both incoming new client connection requests and incoming data from client. I am able to process incoming connection requests and client data.

For example, server has 8 clients connected to it. If client 3 disconnects from server, how will server come to know this client has disconnected and to close its client socket fd gracefully? Does server's select get data on that client socket fd as 'close' data or any error code in recv() function that notifies server to close this client socket fd? Also if client disconnects abruptly without sending close request to server, how should server handle this? Does server get "EPIPE" error?

View 1 Replies View Related

Programming :: Send A Request To A Http Server Without Using Sockets.

Jul 8, 2011

Hi, is it possible to send a request to a http server without using sockets?

View 7 Replies View Related

Programming :: Creating An Automated Bash Scrpit

Feb 2, 2011

list the used variables.

1. display menu until user quits the script
2. menu would give following options to
a. create backup
b. restore files from backup
c. quit
3. for option a or b user would be required to specify the files and name of the archive]
4. has option to be run with use of parameters if that is the case it will not display menu but carry out required task unless it was not possible to do
5. incase of any errors are encountered it would call external scrpit that would display custom disigned error message.

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

Programming :: While Receiving Can Use Functions Like Strchr() To Differentiate These Fields For Sockets?

Apr 15, 2009

constructing a protocol where in it involves sending and receiving different files, so sending data over consists of file name, size of the file and content of the file, so while receiving can i use functions like strchr() to differentiate these fields for sockets? so to allocate memory for file to save i need to have its size.

View 3 Replies View Related

Programming :: Make A Automated Build-script With Bash?

Apr 14, 2010

I'm trying to make a automated build-script with bash but i keep getting different errors that I can't seem to figure out. Could anyone please tell me what's wrong with this package of build-scripts? I'm posting the main build-script and attaching the rest of the scripts in a compressed form. The errors mainly comes from the scripts in "/first_installation/usr/share/siem-live/init"

[Code]...

View 2 Replies View Related

Programming :: Make An Automated Build-script With Bash

Apr 14, 2010

I'm trying to make a automated build-script with bash but I keep getting different errors that I cant't seem to solve for various reasons. what's wrong with this build-script? I'm posing the main build-script and attaching the rest of the scripts in a compressed form. Buld-script link: [URL]

[Code]....

View 3 Replies View Related

Programming :: Print Command Monitoring ?

Aug 17, 2010

I am trying to write a program that monitors when an lp or basically any sort of print command is issued. If a print command is detected I want to pause that job and ask the user if he / she wants to continue.

This program would run in the background all the time so it can't sit and eat up a lot of cpu. I tried a simple while loop that continuously monitored "ps" and that obviously boosted my cpu to 100%.

View 1 Replies View Related

Programming :: Get Data From Serial Port Function Read() Blocks When Data Not Available?

Jun 11, 2009

I am using read() in c++ to get data from a serial port. However, if no data is available on the serial port the function blocks until dta arrives.Example code:

//------------------------------------------------------------
char m_readBuffer[255] = {0};
char* p_curChar = m_readBuffer;

[code]...

View 1 Replies View Related

Programming :: RedHat 8.0 - Monitoring Context Switches

Apr 22, 2011

As a part of a school project I am working on monitoring context switches. I'm working on redhat 8.0, kernel version 2.4.18-14 and for some reason I keep getting unclassified reasons which causing context switches from a process to itself. I am trying to determine each context switch, what was the reason that causes it, whether time slice ended, or yielded, or went for waiting or returned from waiting or parameters changed or task ended to task forked or any possible reason.

But all the time I find that the only switches that I cannot determine the reason happens from a process to itself, all this unrecognized switches from process to itself happens only on interactive processes, and sometimes the need_resched flag is on and sometimes is off. What could possibly cause a context switch from a process to itself? Can a returning of a process with a lower (higher by number) priority from waiting cause a context switch?

View 2 Replies View Related

Programming :: Connect Multiple Sockets From A Single Client To A Single Server And Keep Them Open?

Oct 13, 2010

I have question about the UNIX sockets. my goal is to connect multiple sockets from a single client to a single server and keep them open...I'm not sure if that is possible to create or not. Do you have any suggestion or an example of code?

View 1 Replies View Related

Programming :: Netlink Sockets In Kernel And Ethernet Driver - Kernel Crash

Aug 31, 2010

I write the network driver. Transmission of packets in user space I do through netlink socket`s. In user space there is a handling of packets and their transmission on other device (however, it isn't important).

Problem in that any time, packets through the driver in system, and is reverse, are transferred normally. But then there comes the moment when the kernel crash. If to look in syslog it seems to me that comes deadlock. Also I think that it is related with netlink socket`s.

I can't find the information on that anywhere how correctly to use netlink socket`s in kernel space. Can at you will any a reason into the account of synchronization of sockets and the driver in kernel space?

I can give the driver code if it is necessary.

View 2 Replies View Related







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