Programming :: Unpredictable Behaviour With Send/recv System Call?

Jul 30, 2011

I am making a library, but I am facing a strange problem while sending data over network using ethernet.

I am sending 39 bytes of the data from one server to slave application but some time slave receives 39 bytes and some time it receives 29 bytes. And when ever slave receives 29 bytes all the memories to which my pointers are pointing get changed. This problem is only when I am sending data from the server to slave, while sending data from slave to server I am facing no such issue.

View 10 Replies


ADVERTISEMENT

Programming :: Blocking And Non Blocking TCP Send/recv?

Dec 25, 2010

I 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]...

View 5 Replies View Related

Networking :: Send / Receive Multiple Raw Packets In One System Call

Aug 27, 2010

I need to receive a number of raw ethernet packets (say, 100 packets) into a user-mode accessible buffer large enough to hold all the packets. The way I have done this so far is by looping over the recvfrom() system call 100 times, passing an incremented pointer addressing the location in my buffer to store the packet. Is there a way to receive the 100 packets into my buffer with one system call, perhaps by instructing the kernel to DMA the 100 packets into my buffer?

View 1 Replies View Related

Programming :: Implement A System Call For Displaying The System Statistics

Nov 6, 2010

I have been assigned to implement a system call that report the system statistics over all memory which are

Total Pages in Active LRU list
Total Pages in Inactive LRU List

View 1 Replies View Related

Programming :: Get Source IP From UDP Socket Using Recv()

Sep 29, 2010

I have scoured google for ways to get the source address of the client sent to my server which receives using UDP sockets.

I get the packet with no issue, but I would like to get the source address. Where it currently uses 192.168.0.103, I would like it to be this address.

Code:
#include "rbsocket.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>

[Code].....

View 3 Replies View Related

Programming :: Execvp System Call?

Apr 3, 2011

in below program why was new_args[0], rather than the reference the_cmd, passed to the execvp system call?

Code:
/*
A _very_ limited shell program

[code]....

View 2 Replies View Related

Programming :: Clarification In The Select System Call?

Dec 8, 2010

I have a process that forks, where the childs puts some data of random size and exits while the parent should get the data and does some manipulation.. here I have used a pipe for child to write the data and parent to read the data.. Child simply dumps the data, and the data is of any size even child and parent doesnt know.
I have used select in the parent to see whether there is any data coming on the reading end of the pipe.. if there is a data.. I copy into a buffer.. Im reading the data continusly when the child exits after closing the writing end of pipe. Parent gets blocked on the read part But my question is how parent know the other of pipe is closed when using the select call. In otherwords.. while using select in readfds, how would i know the other end has closed the pipe..

View 2 Replies View Related

Programming :: C - System Call & Error Checking?

Sep 18, 2010

I am trying to figure out how i would go about finding out where system call is made and error checking is not done. I have code below, if somebody can point me in the right direction where system call is made but error checking is not done.Quote:

#include "shell.h"
#include <stdio.h>
#include <string.h>

[code]....

View 5 Replies View Related

Programming :: How To View New Added System Call

Aug 30, 2010

I successfully added a new system call in CentOS Kernel but I don't know where to view it! My kernel version is -2.6.32.5

View 2 Replies View Related

Programming :: Process Of Creating System Call?

Mar 24, 2011

how to create a new system call Linux? what is the process of creating ?my project is to create a system call for displaying owner of a file..where exactly we have to write the system call code? and where are the places need to change ?

View 5 Replies View Related

Programming :: Weird Recv() Buffer Back To Front??

Sep 20, 2010

I have been developing some code which I have been testing an another i386 system. However I have been getting some weird data received on a socket I am communicating with some 3rd party hardware, I have opened a socket to read data on the hardware's telnet port. The data being read is as expected and my code appears to function correctly.

However I have now began testing the code on a target platform, this platform is of a better spec than my development system. When I read data from the socket using recv(), all the expected data has not been read.A chunk of data from the beginning is missing and a portion of data that would be at the end is now at the beginning of the buffer. I'll try and illustrate this below.

[Code]...

View 6 Replies View Related

Programming :: Test New System Call Before Compiling Kernel?

Apr 2, 2009

I want to test my system call that be goint to add to kernel, But when i finish compiling kernel, i found my system call code not work. the code i want to return the system time "struct timespec":

/*----------Start of mycall.c----------*/
#include <linux/linkage.h>
#include <linux/time.h>
#include <linux/kernel.h>

[code]....

so i want a method to test the new system call before compiling kernel.

View 2 Replies View Related

Programming :: Sleep Call Causes Whole GNU System To Hang Indefinitely

May 6, 2011

Anyone know the reason why a sleep( ) on a Redhat Linux OS would cause the system to indefinitely hang? It's doing this every 10 or so calls in my program and I have to press the reboot button on my computer. My program is reading from a UDP port that has messages sent to it 20 times per second. When I sleep I assume the internal UDP buffer is getting more and more filled.

View 14 Replies View Related

Programming :: Make System Call From An Automatically Started Daemon?

Apr 2, 2011

i've written small tool in C which makes measurements on my router (OpenWrt White Russian).

It is working as a deamon. If the tool is started manually, everything works fine. If it is started per script on startup, the following system call doesn't work :

Code: sprintf(command,"/bin/cat /root/%s%s | /usr/bin/ssh -p2222 user(at)host -i /root/.ssh/id_rsa "/bin/cat >> result/%s%s"", apmac, source, apmac, dest);

rc = system (command); the returned rc in this case is 256.

first i thought it is a problems with the user rights for the tool, so i have added +s to it. but that didn't help. as i said, when the daemon is started by hand, the system call works fine.

View 1 Replies View Related

Programming :: Using Scripts In System Call In Applicationand Want Script's Output

Sep 8, 2010

I have a script for dd command and i am using it in an application using system() call. Now i want to have the output of the script file (i.e output of dd command) in the application file itself.

View 1 Replies View Related

Software :: Script That Call A Java Program That Call A System Command?

Nov 29, 2010

In practice I have a script that call a java program that call a linux system command. The script if I run it, from a shell functions well,so it is not a java problem. The problem come out when i put this script in a crontab schedulation. The result in this case is that java do not execute the system command. I think it depends on crontab

View 4 Replies View Related

Programming :: Send Some Data From A System To A Windows System And Vice Versa?

Mar 4, 2010

How can I do some socket programming using which I can send some data from a linux system to a windows system and vice versa. Can we do that using the IO:Socket:INET perl module??

View 10 Replies View Related

Programming :: Poll() System Call Not Returning When The Socket Is Closed Locally?

Sep 29, 2010

we have a multi threaded program on Linux where one thread is waiting on poll() system call with event set to POLLIN, & another thread has closed the same socket fd (which is passed to poll) , but the poll() did not return, is this the expected behavior? From man page of poll we found that the poll should return POLLNVAL if the socket fd is closed, is my understanding correct or is there any bug in the poll()?In Solaris we observed that the poll system call is returning with POLLNVAL if the socket is closed.

View 3 Replies View Related

Programming :: Simple Example Document For Adding A System Call On Fedora 14 Kernel?

Nov 20, 2010

Does anyone have straightforward simple example document for adding a system call on fedora 14 kernel?

View 12 Replies View Related

Programming :: Working With System Call - Read Output And Parse Values

Dec 10, 2010

I have the following code:
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
system("ps -ef | grep myprocessname");
return 0; }

When I run this program it outputs the following list of running processes:
Code:
root 10279 10275 0 13:02 ? 00:00:00 myprocessname myvar1=value1 myvar2=value2
root 10341 10337 1 13:02 ? 00:00:00 myprocessname myvar1=value1 myvar2=value2

What I want to really do is instead of writing the output to screen I want to read the output and parse the various values value1, value2 etc. What is the best way to do this?

View 4 Replies View Related

Programming :: Error 4 Which (according To /usr/include/asm-generic/errno-base.h) Means "interrupted System Call"

Aug 1, 2010

I'm using gmake (v3.81) to build some c executables. As the first step in the process I run the files through a preprocessor (for embedded SQL). The preprocessor completes successfully, but the gmake reports an error and discontinues buiding the remaining dependencies...

make *** [myfile.c] Error 4

which (according to /usr/include/asm-generic/errno-base.h) means "interrupted System Call". My preprocessor doesn't raise any signals, so I'm not sure what's causing this error.

View 2 Replies View Related

Programming :: Sed Strange Behaviour With Line Including Backslash?

Jul 1, 2010

I have a small script that takes input from one file, and uses this input to do a find/replace (with sed) to make an executable snmp trap.The input file could look something like this :JOHBURG SOUTH AFRICAOSLO NORWAY..etcThe script takes the input from this file, and preserves all words in one line as a variable (so that the variables are "JOHBURG SOUTH AFRICA" and "OSLO NORWAY", instead of JOHBURG, SOUTH, AFRICA, OSLO, NORWAY.This is working ok (in the given example, I get two variables).sed is supposed to take this variable, and use it to substitute "HITME" with the new variable.

#!/bin/bash
N=0
cat tutticodes | while read LINE

[code]....

View 21 Replies View Related

Software :: Apache 2 And LDAP Authentication Unpredictable

Nov 4, 2010

I have an issue with Apache2 and ldap authentication. Here are the specs:
Linux 2.6.32-24-generic i686 GNU/Linux Ubuntu 10.04.1 LTS
Apache/2.2.14 (Ubuntu) PHP/5.3.2-1ubuntu4.5 with Suhosin-Patch configured

I have installed our site onto a newer server as we were previously running SLES 9.3. The site has installed correctly, however, It seems to be serving the pages a hell of a lot slower than SLES (eventhough the specs etc are much improved). The main problem seems to be with Ldap - sometimes taking 2 or 3 minutes before authenticating/serving the user - and sometimes one minute it works, another minute it doesn't! We know it's a problem specific to this Ubuntu machine, as the older server has no issues with ldap whatsoever. Also, sometimes the ldap authentication fails all together with a timeout, resulting in a 500 status code. I'm not sure whether this a problem with the apache config, the network settings or the server setup. We know ldap itself is fine.

Here's the /etc/apache2/sites-available/default config for ldap. Are these directives correct? (I know a lot of changes were made between apache2 and apache2.2 that may affect this config):
Code:
ScriptAlias /home/ "/var/www/cgi-bin/"
<Directory "/var/www/cgi-bin/">
AuthType Basic
AuthzLDAPAuthoritative On
AuthBasicProvider ldap
AuthName "Active Directory Authentication Required."
AuthLDAPURL "ldap://x.x.x.x:3268/DC=xxxxxx,DC=com?userPrincipalName?sub?(objectClass=*)" NONE
AuthLDAPBindDN "xxxxx@xxxx.com" AuthLDAPBindPassword xxxxxxxx
require valid-user Options +ExecCGI -Includes AllowOverride None
</Directory>

Here's some examples of some of the log messages we have been receiving:
1. This one occurs upto ten times in a row when the client is being authenticated:
Code:
[Thu Nov 04 12:47:19 2010] [debug] mod_authnz_ldap.c(377): [client x.x.x.x] [2892] auth_ldap authenticate: using URL ldap://x.x.x.x:3268/DC=xxxxxxx,DC=com?userPrincipalName?sub?(objectClass=*), referer: http://x.x.x.x/home/page

2. This is output when the authentication works:
Code:
[debug] mod_authnz_ldap.c(474): [client x.x.x.x] [2734] auth_ldap authenticate: accepting xxxxx@xxxx.xxxxx.com, referer: http://x.x.x.x/home/page

3. And this one is always output after the error above. This one is more interesting. What does this mean exactly? And why does it say 'declining to authorise' directly after saying 'accepting user@domain.com'? Surely this makes no sense:
Code:
[debug] mod_authnz_ldap.c(546): [client x.x.x.x] [2939] auth_ldap authorise: declining to authorise (no ldap requirements), referer: http://x.x.x.x/home/page

4. This one is output when the authentication attempt times out (after 10 outputs of error number 1):
Code:
[warn] [client x.x.x.x] [3165] auth_ldap authenticate: user xxxx@xxx.xxxxx.com authentication failed; URI /home/page [LDAP: ldap_simple_bind_s() failed][Can't contact LDAP server], referer: http://x.x.x.x/home/page

View 3 Replies View Related

Programming :: Add Switch To Every Gcc/g++ Call?

Feb 23, 2009

I was wondering if there was a way to add a switch to a gcc/g++ call everytime. I have a few libraries that I need to compile for different processors. Each has a makefile which calls gcc to compile. Here is the best option I could come up with so far:Include a Makefile and define CC as gcc -mcpu=xxx.

View 4 Replies View Related

Red Hat / Fedora :: Unable To Add System Call

Dec 3, 2010

iam trying to add a system call to the kernel version 2.6.33.7.Iam running fedora 13.I have followed all the steps given in this <hekimian-williams.com/?p=20 -> tutorial,but iam getting a error in make saying undfined reference to mysyscall in syscall_table_32.

View 1 Replies View Related

General :: What Is Signal0 In System Call

Sep 28, 2010

what is what is signal 0 in linux system call ?i can't find that in kill -l signal list . i need to know what is signal 0 . * for examples signal 1 is SIGHUP and signal 2 is SIGINIT . what is signal 0 ?

View 1 Replies View Related

General :: Unpredictable And Arbitrary Crashes When Typing An Email

Jan 13, 2011

I experience unpredictable crashes, When typing an email I am unable to recapture that which I wrote. without warning the "back" button disappears. it is sometimes there and sometimes not.

View 3 Replies View Related

Server :: Unpredictable 403 Responses For Image-parsing PHP Script?

Jan 14, 2011

I've got a page with an elaborate javascript in it (imageflow) that is meant to emulate the apple coverflow that you see on iPhones. It wasn't my idea to use it but I must fix it.

This elaborate javascript, in order to show reflections of an image, makes use of a PHP script that will take an image as input, invert it vertically and create a reflection image dynamically. The script is called reflect2.php.

The problem I'm having is that the reflect2.php script is unpredictably returning 403 (forbidden) or 404 (not found) errors sporadically. The behavior will vary for a given image so it's apparently got no relation to the image format. For example, I will load my page and I'll get some 403/404 for certain urls (which correspond to images in my page):

FIRST ATTEMPT - only one bad reflection image url

The second time I load the same page, that previously broken image will be fine but this other one will be broken
SECOND ATTEMPT url

The third time, all the prior images are fine and this image, which was fine before, is not 403:
THIRD ATTEMPT url

I don't know why a given request to reflect2.php might result in a 403 reponse. As far as I can tell there is no code in the script that would result in such a header being sent for any reason whatsoever. I'm wondering if this might be a problem with Apache somehow. I'm on thin ice when it comes to Apache configuration values but perhaps there's a limit in the simultaneous connections permitted, the number of PHP threads available, or the keep-alive values or something?

View 14 Replies View Related

Programming :: Call C Executable Inside C

Jan 8, 2010

i have only basic knowledge of C so guys plz help me...is C language support call the C executable inside the C ?example contect mainA.c have a many function define in the struct,when i compile mainA and make a executable the name is ( A ),can i use executable C inside the C <my C program call the executable ( A ) > .

View 9 Replies View Related

Programming :: Call The Executable File From The GUI?

Jun 1, 2010

I have created a executable file using c and I have also created a GUI using GTK+. Now how can I call the executable file from the GUI with arguments passing to the executable file.

View 4 Replies View Related







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