Programming :: Remote Client Mac Address On Socket Descriptor?

Dec 14, 2010

I want to get the connected client MAC Address after accept() call. I can get the IP address of the client but i don't know how to get the client MAC Address in my this programme. Here I am Posting my Code.

#include<stdio.h>
#include<sys/socket.h>
#include<sys/types.h>

[code]....

View 10 Replies


ADVERTISEMENT

Programming :: Fetch The Remote Client Mac Address On Socket Descriptor?

Dec 14, 2010

I have written one simple code which is posted here. i want to fetch the Mac Address on socket descriptor which is returned after accept () call.

Code:-

#include<stdio.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netinet/in.h>

[code].....

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

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 :: Socket Programming Using Php - Swap A Client Ip And Port?

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

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

Programming :: How Could Server Detect Closed Client Socket Using TCP And C++

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

Programming :: Bind The Listening Socket To A Paricular Ip Address And Port?

Jun 26, 2011

I am learning network prgramming in linux in c,and try to build a server and in this server I want to bind the listening socket to a paricular Ip address and port.Bind function is showing error,I did not want to use wild card. Here is the code.

#include<stdio.h>
#include<sys/socket.h>
#include<strings.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<string.h>

[Code]...

View 2 Replies View Related

Networking :: Remote Access Using Socket Programming - Open A Cmd.exe

Dec 16, 2010

i want to open a cmd.exe of a remote machine in my own machine.. i am using c language. its just for educational purpose.

View 9 Replies View Related

Programming :: Get The Ip Address Of The Client Machine?

Jan 2, 2011

I am connecting to linux server(RHEL4.7) using putty from my windows machine. Is there any way to get the ip address of my windows machine using C program in linux.

View 9 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 :: 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 View Related

Programming :: Reuse Socket Fails "Address Already In Use" Or "Connection Refused"?

May 14, 2010

Problem: can't restart programs which use socket to communicate.

Symptom: Restart Listener dies "Address already in use".
Restart Caller dies "connection refused"
System: Ubuntu 10 (and 9)

[code]...

View 3 Replies View Related

Programming :: Pyhon - Get The File Descriptor?

Apr 19, 2011

I create two script file name for "a.py" and "b.py", It's through socket connection.
a.py's file writeing "os.pub(s.fileno,x)"create the file descriptor,but i don't know how to get the descriptor file with "b.py"

View 2 Replies View Related

Programming :: What Does Closing A File Descriptor Mean

Mar 13, 2011

As we know, every process has a table with a file descriptor table, in which each entry contains a file pointer pointing to the corresponding file table which contains a v-node pointer pointing to the v-node table.

When closing a file descriptor, are all these data structure deleted?

View 2 Replies View Related

Fedora :: Remote Desktop Client (RDP) Aka Terminal Services Client?

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

Red Hat / Fedora :: Log Remote Or External Ip Address Of Remote Clients?

Sep 15, 2010

We're using both SuSe and RHEL servers. Our servers are running behind firewall device and remote root login is disabled in SSH.

We're using NAT.

Remote client connections including failed logins are logged into the /var/log/messages but what is logged are gateway ip of our LAN - the LAN IP of Firewall device.

How can I logged the external or public IP of the remote client?

View 4 Replies View Related

Networking :: Can't Bind Send Socket: Address Already In Use

Feb 23, 2009

I am currently trying to get a B.A.T.M.A.N mesh network up and running. the thing uses UDP port 4305 for broadcasting to nearby nodes and it seems this port is closed or used by something else.

now i have tried to open this port with commands like

Code:

iptables -A INPUT -p udp --dport 4305 -j ACCEPT
iptables -A OUTPUT -p udp --dport 4305 -j ACCEPT

it still gives me the same error saying the socket cannot connect.any way for me to scan that udp port, see what is blocking it and open the thing up ?

View 4 Replies View Related

Programming :: PyGTK: Send Output From A File Descriptor To A Textview?

Jul 22, 2010

Within PyGTK I'm using gobject.spawn_async to launch a bash script. I would like the output of that bash script to be displayed within my application. I have a textview set up to receive the text ...

Here are the commands that launch the program:

Code:
def run_command(command):
global keep_pulsing
keep_pulsing=True
(cpid, cstdin, cstdout, cstderr) = gobject.spawn_async(command,flags=gobject.SPAWN_DO_NOT_REAP_CHILD|gobject.SPAWN_STDERR_TO_DEV_NULL,standard_code....

Here are the two callback functions. But like I say ... I have no idea how to get that data from the 'cstdout' file descriptor into a textbuffer.

Code:
### THE FOLLOWING ARE GLOBALS:
textview = wTree.get_widget('textview1')
textbuffer=textview.get_buffer()
def update_textview_callback(fd, condition):
global keep_pulsing
if keep_pulsing:
progressbar.pulse()
code....

View 3 Replies View Related

Networking :: Connect To A Remote Machine Using Tcp Socket?

Mar 2, 2010

#server.pl
use IO::Socket;
$| = 1;
$socket = new IO::Socket::INET (
LocalHost => '10.100.207.13',
LocalPort => '5000',
code....

it displays the message "couldn't connect to the server". How can i connect to the remote machine using tcp socket?

View 3 Replies View Related

Fedora Networking :: Socket() Address Family Not Supported By Protocol

Aug 18, 2010

This message appears very often in teh output of very different programs, for example Firefox/Swiftfox, Thunderbird, Mplayer In case of Mozilla apps it sometimes freezes KDE interface too (can't switch windows or panel does not pop-up) for a few seconds. IPV6 is not compiled into kernel and module is not built. It is disabled on the eth0 interface too.

View 1 Replies View Related

Ubuntu :: Failed To Create UDP Socket (SIP) On Port 5060 Address

Mar 13, 2010

I can't seem to get on my Twinkle SIP Phone, it says: "Failed to create a UDP Socket (SIP) on port 5060 Address already in use" after that message it brings me back to the window were I'm supposed to run my profile, how do I fix this?

View 6 Replies View Related

Fedora Servers :: OpenVPN - Socket Bind Failed On Local Address

May 4, 2011

I finally got the certs to configure:
openvpn --config server.conf
Tue May 3 17:26:27 2011 OpenVPN 2.1.1 i686-redhat-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] built on Jan 5 2010
Tue May 3 17:26:27 2011 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Tue May 3 17:26:27 2011 Diffie-Hellman initialized with 1024 bit key
Tue May 3 17:26:27 2011 TLS-Auth MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ]
Tue May 3 17:26:27 2011 ROUTE default_gateway=192.168.122.1
Tue May 3 17:26:27 2011 TUN/TAP device tun0 opened
Tue May 3 17:26:27 2011 TUN/TAP TX queue length set to 100
Tue May 3 17:26:27 2011 /sbin/ip link set dev tun0 up mtu 1500
Tue May 3 17:26:27 2011 /sbin/ip addr add dev tun0 local 10.8.0.1 peer 10.8.0.2
Tue May 3 17:26:27 2011 /sbin/ip route add 10.8.0.0/24 via 10.8.0.2
Tue May 3 17:26:27 2011 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ]
Tue May 3 17:26:27 2011 Socket Buffers: R=[114688->131072] S=[114688->131072]
Tue May 3 17:26:27 2011 UDPv4 link local (bound): [undef]:1194
Tue May 3 17:26:27 2011 UDPv4 link remote: [undef]
Tue May 3 17:26:27 2011 MULTI: multi_init called, r=256 v=256
Tue May 3 17:26:27 2011 IFCONFIG POOL: base=10.8.0.4 size=62
Tue May 3 17:26:27 2011 IFCONFIG POOL LIST
Tue May 3 17:26:27 2011 Initialization Sequence Completed

But openvpn still won't start; where to go from here.
Tue May 3 17:54:25 2011 TCP/UDP: Socket bind failed on local address 192.168.122.3:1194: Address already in use
Tue May 3 17:54:25 2011 Exiting

View 3 Replies View Related

Networking :: Using A Perl Script To Test For A Socket Listening On A UDP Port On A Remote Host?

Mar 10, 2011

is it possible using a perl script to test for a socket listening on a UDP port on a remote host ?I work in an environment where netcat is not allowed and from time to time I need to see if a UDP port is open on a remote host.

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

Programming :: Socket Programming: Insertion Of 0x00 Into The Stream?

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

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







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