Programming :: Setsockopt : Socket Operation On Non-socket Getting Error?

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


ADVERTISEMENT

Networking :: /usr/sbin/in.telnetd: Getpeername: Socket Operation On Non-socket?

May 5, 2009

I had installed Fedora 10

Below is the output of uname -a

Linux 2.6.27.5-117.fc10.i686.PAE #1 SMP Tue Nov 18 12:08:10 EST 2008 i686 i686 i386 GNU/Linux

I need to enable telnet service on it, then found xinetd and telnet-server not installed,

Then I had installed below
First I had installed Xinetd: xinetd-2.3.14-21.fc10.i386.rpm
then I had installed telnet-server: xinetd-2.3.14-21.fc10.i386.rpm

After installation I executed below commands

Service xinetd start
Chkconfig xinetd on
Chkconfig telnet on
Service iptables stop
Chkconfig iptables off
Iptables �F

After I had tried telnet localhost ----IT FAILED

when I run telnet server manually by issuing the below command
/usr/sbin/in.telnetd, I get below error
[COLOR="Red"]/usr/sbin/in.telnetd: getpeername: Socket operation on non-socket[/COLOR]

I have other system running same OS, I had followed the same steps discussed above to enable telnet, It works fine on it.

View 1 Replies View Related

General :: Socket Programming - Feed Some Words One By One To The Socket

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

Programming :: Socket Programming - Detect Whether A Client Socket Is Closed / Active?

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

General :: Socket Error / Socket 31: 0x36?

Sep 15, 2009

We are seeing recv err on socket 31: 0x36. What could be meaning of the error?.

View 1 Replies View Related

Networking :: Multiple FTP Upload Socket Error "Connection Reset By Peer: Socket Write"

Jan 31, 2010

I am pragmatically trying to upload a list of files from my client machine to a proFTPd server I have running on Ubuntu. Every time I get several (around fifty) files into the transfer, I get the following error: Quote: Connection reset by peer: socket write error

I am able to remotely upload 25,000 small files of ~ 1K in size, but when I go to upload hundreds of 2-4 Mb files, I get a socket write error. Am I using up all available sockets before they can be released? If so, how do I release the sockets? If not, what does this error mean and why am I getting it?

View 1 Replies View Related

Networking :: Configuring Socket Timer To Release Socket Once The Connection Is Terminated?

Jun 4, 2010

I want to configure socket timer to release socket(port) once the connection is terminated. Do we have something in Linux OS to configure this delay to release socket?.

Any command, link or man-page anything will be helpful.

I browsed a lot but unable to find it.

View 1 Replies View Related

Server :: Socket Connections / Socket And TCP Connection For Connecting To An External System?

Dec 7, 2010

Anyone knows the difference between a socket and TCP connection for connecting to an external system?

View 1 Replies View Related

Programming :: Error With Socket Shared Between Functions?

Dec 21, 2010

Let's show the problem: I have a socked connection (in a fd var). In certain moment, I need to use the same socket in two threads. Lets see in the example:

Code: int main(void)
{
int fd; // the socket

[code]....

View 9 Replies View Related

OpenSUSE Install :: MySQL Socket Change For 11.2 / Get The Socket To /var/run/mysql?

May 25, 2010

In looking at the release notes, I saw the comment File locations changes:

* MySQL socket file and pid file were moved from /var/lib/mysql to more reasonable location /var/run/mysql by default.

* MySQL log files are in /var/log/mysql. Not sure what I was supposed to do with that information. So I ignored it. Now, I am finding some issues with it. The web server works, but any connection to the database fails with 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)The thought dawned on me that maybe all my databases were erased and none set up. Going in to the terminal, I could connect and list and query the databases. So even though I backed them up, they still are there!

phpMyAdmin gives the same error message.

However, when I go into MySQL Administrator, it works fine.

I forgot where I saw it, but the socket is still set to var/lib/mysql. I could not find any mysql install log and would say what was in my cnf.my, but it still doesn't exist just as it has not in the past. Not sure if I should allow the MySQL Administrator to create it since I always ignored the prompt in the past and it worked. (Just wishing to keep the defaults)

At first I thought the upgrade upgraded the MySQL, but it's still 5.1.39 as I believe before. I've un-installed mysql-server and re-installed it with no change.

Can anyone can tell me how to get the socket to /var/run/mysql or what else is wrong? I read one place where mysql is supposed to set it up.

View 9 Replies View Related

Programming :: Send A UDP Msg Across A Socket?

Jan 24, 2011

Has anyone had an issue with gdb not being able to send a UDP msg across a socket?

I have ComponentA sending a msg to ComponentB utilizing gdb. ComponentB gets the msg. ComponentB sends a msg to ComponentC. ComponentC does stuff to the msg and sends a msg back to ComponentB using gdb.
ComponentB never seems to receive the 2nd message.

If I don't use gdb the messages Tx and Rx without an issue.

I'm flying blind without gdb to figure out a different bug.

View 3 Replies View Related

Programming :: Name A Socket By Bind?

Oct 20, 2010

How does bind system call names a socket.Code:bind(server_sockfd, (struct sockaddr *)&server_address, server_len);I see use of bind in majority of programms as above.But any of the arguments is not the name of socket.

View 1 Replies View Related

Programming :: Timer In Socket Programming - Wait For X Sec After Read() And Then Disconnect The Client Connection

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

Programming :: Socket And Timer Programming - Server Doesn't Execute Any Msg Which Client Sent

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

Programming :: Raw Socket Not Sending Packets?

Mar 26, 2010

(Let me first of all state that I am a newbie to any form of programming.) I have been trying to create an IP header + TCP header and send this to another machine on my network.using C)I used the normal stuff: two structures for the headers, a sockaddr_in structure, call to function socket with SOCK_RAW, setsockopt with HDRINCL and call to sendto.All functions seem to return fine (values other then -1) the function that I have used to calculate the checksum for the IPheader matches the value that I manually calculated. I just don?t see the anything coming out of the interface on whireshark.I assumed that it had something do with my piece of code so I used two examples (including mixter void ru rawip html A brief programming tutorial in C for raw sockets[/url]). They show exactly the same thing functions return fine but no packets being send.I use Ubuntu 9.04 2.6.28-14-genericThe machine has two interfaces one with an ip address the other interface is in promiscuous mode. (both interfaces connected to a switch with port mirroring) I can see all normal traffic in/out.

View 2 Replies View Related

Programming :: Socket And Segmentation Fault

Jul 16, 2010

I am programming an application with an ARM device with an embedded version of Linux. My application talks to a java application via socket. If there is any connection problems, it attempts the connection again. My problem is that after exactly 146 times, there is a Segmentation Fault. Apparently this happens in opening the socket, which is not successful after this amount of attempts.

Following, some code that I'm using:

The function for openning the socket and perform a connection:

Code:

View 2 Replies View Related

Programming :: Read Data From A Socket?

Aug 24, 2010

I need to read data from a socket but it should be always listening because data arrives continuously .. I thought something like this would do it but it doesn't work .... I already set the socket options before

Code: char databuf[1024];
int datalen = sizeof(databuf);
if(read(sd, databuf, datalen) < 0)
{

[Code]....

View 9 Replies View Related

Programming :: Use Hostname (a URL) In Socket Program?

Aug 2, 2010

I don't have the IP address & Port of the server but I know the hostname (URL) to establish a connection.How can I use it to get connected to the particular host?

View 4 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 :: Multiple Threads In Socket C++?

Nov 26, 2010

Code:
void* thread(void* arg)
{

[code]....

View 5 Replies View Related

Programming :: Non Blocking Socket Send

Mar 7, 2011

Been trying all sorts of different things to implement a non-blocking send on a TCP server socket.As I kill the client, the server keeps blocking on the send no matter what. Am I missing something? Any other way to do that without involving any additional thread?

View 4 Replies View Related

Programming :: Socket Programming While Displaying Received Message In File

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

Programming :: Use Socket Programming In Order To Implement Chatting Feature?

Aug 25, 2010

how to use socket programming in order to implement chatting feature

View 5 Replies View Related

General :: Error - Could Not Open Socket ?

May 5, 2010

I'm using PHP on a centos server to send emails out. It should use smtp with authentication to send out and one of the credentials is the hostname but in trying to use those credentials I get this error:

Zend_Mail_Protocol_Exception: Could not open socket

However, when using an ip address instead of the host's name it seems to work making me think this is a server issue/Centos issue.

View 3 Replies View Related

Ubuntu :: VLC Not Starting - Main Interface Error: Socket Bind Error (Permission Denied)

Oct 17, 2010

I tried removing it and installing again but I still get the same code in the terminal:

[Code]....

View 3 Replies View Related

Programming :: Chat Socket Between Client And Server

Mar 17, 2011

I want to built a Chat Program (based on Socket connection) between client and server. I use the GTK+ &GLADE graphic tool. Can you send me the code for this program or any material to learn. Also, I want to know how to show the input to text view (in GTK+&Glade).

View 3 Replies View Related

Programming :: Handle Query Strings Using Socket?

Dec 7, 2009

I need to make a daemon which listens to port 81 for messages like [URL] So far I made a daemon which serves as a simple stream server: I set up a socket to listen to a non-reserved port (like 9999), but I don't know how to read the query strings.

Linux distro: Kubuntu 9.04
Language: C

View 5 Replies View Related

Programming :: Receiving The Entire Message Using TCP Socket?

Apr 15, 2010

I am trying to create a socket server in user space and a client in kernel space and send big messages (a little over 64kbytes) between them.

I used an kernel socket programming examplefrom this link - url for the kernel client side.

When the client in kernel side sends out a 64k message, usually, the server side in the user space will get a big part of the message, but will stuck at waiting for the recv() to return to get the rest of it. So I am chopping the packets into small pieces, 1000 bytes each to send to the server. But only some times, the packets will all arrive at the server/receiver side, and the server and assemble the whole message. Many times, the server is stuck at waiting for the last a couple of byte from the sending side. From the sending side printk log, it has already sent every thing.

I am attaching some log here, and the code at the end. Can someone give me some idea on how to force the data to arrive at the receiver side? Maybe the kernel on the receiver side is holding part of the packet so
the receiver program in the user space is blocked at recv()? I tried adding TCP_NODELAY on sockets on both sender and receiver sides, both it did not help.

I got a connection from (10.16.216.217 , 1489)
- Server side stuck on recv()-
bytes_recieved 17384
bytes_recieved 32768, total received 50152, expected 65540
- Client side is already done -
code....

View 2 Replies View Related

Programming :: Send Text File Over Socket

Nov 20, 2008

how can i send a text file from server to client? the problem is, i dont know how to send those two file to the client ( center node)

View 1 Replies View Related

Programming :: Tcp Client Socket : Get Own Port Number?

Oct 1, 2010

I am working with simple tcp client to establish connection to sockaddr_in servAddress and send data segment:

...
connect(sockfd,&servAddr,sizeof(servAddr)) < 0)
send(sockfd, pkt, pktLen, 0);
close(sockfd);
...

Elementary... Here's the tricky part: next i have to handle user level ack the server is sending to "client"... To do that i have to open server socket on the same port number the system assigned to my client socket before. How can i get it ( in user level code)?

View 2 Replies View Related







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