Programming :: Sets Sigpipe's Default Action To Ignore And Opens A Socket?
Jul 27, 2011
I'm studying an OS programming book, in particular network sockets. I have two questions(2nd one is down at the bottom). There is something I don't quite understand. What if this piece of code, which sets sigpipe's default action to ignore and opens a socket:
Code:
if ((u_ignore_sigpipe() != 0) || ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1))
return -1;
[code]....
View 3 Replies
ADVERTISEMENT
Mar 27, 2011
I have a Socket library, written in C++, in which the method used to send data never has the opportunity to handle an errno of SIGPIPE. Thus I thought perhaps I should setup a signal handler to receive the signal, but this too is not being called.Is there something that I am missing or doing that is completely wrong? Below is the relevant code. Note that a SIGPIPE signal is generated when the Server is unable to send data to the Client (e.g. the client has terminated).Server code:
Code:
#include <TCPServerSocket.hpp>
#include <string>
[code]...
View 1 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
Jul 6, 2010
i'm writing a simple program of client socket program. Here below is the code sample which i'm writing...
Code:
//tcp_client.c
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include<string.h>
#include<stdlib.h>
[Code].....
the above code works fine.if we copmile and run ./a.exe 192.xx.xx.xxx 1111 and press enter it works fine..everytime it asks "Please enter the message: " and if give that will be displayed in server. but my problem is i dont want to print everytime "Please enter the message: " i just want to feed some words one by one to the socket.
View 4 Replies
View Related
Mar 30, 2009
im getting that error in my code for some reason. I compiled my code, and when i try to run this server it throws me an error on my call to setsocketopt(). The only way it can reach that part of my loop is if it succeeds when it calls sock() so I dont understand why the error says its an operation on a non-socket. Im just trying to set up a server to pass messages from a client to it a viceversa. Here is the code:
Code:
int main()
{
int socket_fd, new_socket_fd, k;
struct addrinfo hints, *server_info, *p;
struct sockaddr_storage peer_address;
code....
View 7 Replies
View Related
Mar 2, 2011
I've written a simple server in linux used fork to create a FIFO pipe.The server create two FIFO pipe.One for server read data from client and write data to client.Then another pipe for client read data from server and write data to server.When the server read data from a client used server-pipe and then write data to client.But ,if the client no read open the pipe,the server side write will be crashed because of a broken-pipe SIGPIPE. How to check whether the read side is opened?Or,how to catch the SIGPIPE,and then my server will still execute on,not crashed!!
View 5 Replies
View Related
Aug 14, 2010
Is there a way to have the default 10.04 file explorer ignore capitals?
eg: If i have the files
BOB_1
BOB_2
BOB_3
bob_4
bob_5
bob_6
Ubuntu by default lists them in order starting with the lowercase letters 4-6, followed by the upper-case letters 1-3. I want them to be displayed in the order listed above.
If this isn't possible, can I rename every single file in a folder to be made up of only caps?
View 3 Replies
View Related
May 28, 2010
I did a fresh install of 10.04 a couple of weeks ago, and all seemed well, but lately when I double-click on, say, an OpenOffice (.odt) file in Nautilus, I get the following message:The file '/home/zerubbabel/Documents/Teachings/Queue/2010.05.15-A02.odt' is not marked as executable. If this was downloaded or copied form an untrusted source, it may be dangerous to run. For more details, read about the executable bit.(The pop-up window title reads: "Blocked: wine start /unix"). I've repeatedly set the "Open with..." and checked "Remember this application...", but it doesn't "stick".
View 5 Replies
View Related
Sep 15, 2010
So I was reading this thread on internet privacy and decided to 'upgrade' my system. I installed privoxy and tor and chained them from squid so it looks like this: iceweasel >> squid >> privoxy >> tor. All is working well except when I go to edit my privoxy default.action file I get a fatal error. I've got version 3.0.9-1 The original line in the newly installed default.action file. #+hide-referer{forge}
I edited it by simply removing the #. +hide-referer{forge} Then:su -c '/etc/init.d/privoxy force-reload'And I get this in the logfile.Sep 14 16:41:36.260 Privoxy(7f4fa64756e0) Fatal error: can't load actions file '/etc/privoxy/default.action': first needed line (361) is invalid: +hide-referer{forge} I've even copy/pasted from the manual and to no avail.Have I been looking at to much text for the last two days?What am I missing?
View 1 Replies
View Related
Apr 12, 2011
I have accidentally set my default option for a blank disc and told it not to ask me again. When I put a disc in, it runs that option and I can do nothing else unless I open up a different program manually. How do I access and edit this option again?
View 2 Replies
View Related
Nov 25, 2010
Is there a way to set the default when clicking on a folder to open in new window? The default action appears to open in the same window. I've gone though every Dolphin option I can find, and there does not appear to be any setting that affect this. Konqueror DOES have a setting, but it seems to be ignored. I am running Suse 11.3, KDE 4.4.
View 3 Replies
View Related
Aug 3, 2010
How can I set 7ZIP to be the default program that opens .rar files? I am using Ubuntu 10.04 32bit LTS
View 2 Replies
View Related
Mar 11, 2010
I'm working on a backup script which takes the following input:
Code:
RevBackup.sh <options> <source> <target>
The problem I'm having is that the source and target might contain spaces in the path. ie. /home/eRJe/My Documents
I would like the script to ignore " " (backslash-space) as being a delimiter. how could I do this without stopping a normal space from being a delimiter?
I could do this with IFS. But so far I have only found info about setting a delimiter and not to "ignore" one
View 4 Replies
View Related
Jan 9, 2010
The default contents for the file that opens when you run gksudo gedit /etc/grub.d/05_debian_theme in terminal.
View 3 Replies
View Related
Feb 3, 2010
How do i make my strings case-insensitive while comparing them with an if statement?
View 2 Replies
View Related
Nov 12, 2010
This is what I have
Code:
When I run the program it will print
Quote:
rather than
Quote:
And completely ignore the kbd.nextLine statement.
However, when I write next instead of nextLine, it works.
View 3 Replies
View Related
Jun 4, 2011
I've got a non-urgent but itchy thing here - I'm implementing a drag-and-drop. All rolls well, but I'd like to have the component be "followed" - if there is a drag on the component, the form should be visible. I'd like to make a puzzle where the player can see the perimeter of the piece to see if it fits where (s)he'd want to drop it. Before I delve into the tons of code, I'd like to know if that (the following) can be done.
View 2 Replies
View Related
Aug 7, 2010
I've ran into something rather odd. I've installed wine and Office 2007. If I am to open a office 2003 (doc) or office 2007 (docx) file, it will open wine and office 2007 to edit the file. This is the desired behaviour. If I am to open an office 2003 (doc) file in firefox, openoffice will be opened. If I am to do the same with an office 2007 (docx) file, wine and office 2007 will open.where to start to get wine/office 2007 to open files from firefox?
View 3 Replies
View Related
Jan 6, 2010
How do I write my trap statement in shell script to ignore SIGINT.Reason being is that the script is used to update records in database. I want to avoid inconsistency in database when user presses Ctrl-C .The result should be
1. Totally ignore Ctrl-C (SIGINT) when user presses Ctrl-C
2. Continue with the rest of processing
View 3 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 16, 2011
i have a server program which accept multiple client connection and am using polling. like every 2 secs it will look to client whether any data is received after it binded. i have used setitimer but there is runtime error i got.. the server accept all client connection but doesn't execute any msg which client sent.
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netdb.h>
#include<unistd.h>
#include<pthread.h>
#include<string.h>
[Code]....
View 1 Replies
View Related
Aug 17, 2010
After a kernel update, the system always updates the GRUB menu, and the newer kernel is the default boot option.However, after an update on my F13 X64 system, the GRUB menu was updated, the config file still sets the default to "1" but if i left the automatic boot it will boot the previous kernel... am I crazy or missing something here?Here is my /boot/grub/grub.conf file:
Code:
#boot=/dev/sda
default=1
[code].....
View 4 Replies
View Related
May 11, 2011
i have problem in socket programming, while displaying received message in file,i got a problem... i cant able to write it in the file.... this is the code....
Code:
/* tcpserver.c */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
[Code]....
now my problem is run time error i can able to create file but i cant able to write file....log.txt contain nothing.... as here i have give sample code... dont say not initialising function and all.... i have initialised , please only see func1() - my problem is only not able to write msg which i got received from the client..
View 2 Replies
View Related
Aug 25, 2010
how to use socket programming in order to implement chatting feature
View 5 Replies
View Related
Feb 22, 2010
A bit clumsy subject, but I would like to make a script, which is able to send and receive email messages from CLI. The script should work like this:
1. read user input from stdin(for example a mail address)
2. send mail over SMTP(SSL, port 465) to a mail server
3. mail server sends an automatic response, script should just display this response email sent from mail server over IMAP(port 993)
At the moment I have a fallowing configuration in my Thunderbird:
Code:
IMAP mail.domain.com SSL 993
SMTP mail.domain.com SSL 465
Is it possible with 'mail' utility? Do I need to configure some sort of MTA at first(I use SUSE and I have Sendmail installed by default)? What are the steps, to get this script working?
View 1 Replies
View Related
Dec 5, 2010
When sending data over the socket, the sending socket includes 0x00 after each sent byte. I wonder how this can be avoided -- I just want to transfer the data in the tx_buffer as it is.
# ./serv &
[1] 6895
# ./EUG 127.0.0.1
EUG: Data to be transmitted: 0x35 0x32 0x30 0xff 0x03 0x31
EUG: Data - #Bytes transmitted: 6
./serv: Here is the message: '5'
[Code]...
View 3 Replies
View Related
Mar 28, 2011
Is it possible to swap a client ip and port ? This is what I am trying to do. Let say you have Comp1 and Comp2 And you have Server between them. My goal is to get Comp1 and Comp2 know each others IP So Comp1 connects to server And server stores comp1's IP In a text file or other place And Comp2 connect to server And server also stores his info And then both comp1 and comp2 dowload the tex file And use the info on it.
View 9 Replies
View Related
Jan 30, 2011
How can we build a packet using C?we have a structure called sockaddr_in which is use to for IPv4,so that we can define address,port and etc in this way:
Code:
struct sockaddr_in sock;
sock.sin_family=AF_INET;
[code]...
View 5 Replies
View Related
Nov 11, 2010
This is my main question:Quote: In raw socket sniffing: how do I copy data from a structure into a char[] or pointer? My problem: I started doing some raw socket programming in OpenWRT (I'm a newbie) for research. It's been a long time since the last time I programmed in C, so here's my newbie question/problem.
I'm receiving packets and using an .h file with the structures to get the information of each 802.11 packet in monitor mode (attached to this post).My (simple) goal is to get the Tx MAC Address. No luck. This is my "read the prism header" function:
Code:
ParsePrismHeader(unsigned char *packet,int len)
{
wlan_header *wlan;ieee_802_11_header *i802;u_int16_t eth_type;
unsigned char *mac;unsigned char *mac2;
wlan = (wlan_header *)packet;
i802 = (ieee_802_11_header *)(packet + wlan->msglen);
[Code]...
View 3 Replies
View Related
Jul 23, 2010
I am currently doing a research on video transmission over wireless LAN. I tend to transmit my offline file (xx.svc) from server to client.It may sound stupid (since I have a very little knowledge about c programming and raw socket), but my biggest challenges is that when I want to write the file to the buffer, how actually to define/include the file at the programming coding? where I need to locate the file? Is it at the same folder with my c programming, or somewhere in the linuxinclude folder?
Can anyone just give a simple example on how to include a file and write it into a buffer before send it through raw socket.
View 14 Replies
View Related