05-15-2002
A socket is the combination of an IP adress and a port number. E.g when you browse some homepage you make a TCP connection to a destination socket say "192.168.1.1, 80". But in order to get data from the webserver you (the client) must also have a socket, a source socket, say "192.168.21, 3032".
Networking is not a simple subject so I suggest you go buy a book or start reading some
network tutorials if you want to know more.
hope this helps
10 More Discussions You Might Find Interesting
1. Programming
Hello,
I actually try to make client-server program.
I'm using SCO OpenServer Release 5.0.0 and when I try to compile my code (by TELNET) I've got this error :
I'm just using this simple code :
and I get the same error if I use :
If someone can help me,
Thanks (2 Replies)
Discussion started by: soshell
2 Replies
2. UNIX for Advanced & Expert Users
Hi,
I was porting ipv4 application to ipv6; i was done with TCP transports. Now i am facing problem with SCTp transport at runtime.
To test SCTP transport I am using following server and client socket programs. Server program runs fine, but client program fails giving Invalid Arguments for... (0 Replies)
Discussion started by: chandrutiptur
0 Replies
3. Programming
Hi all,
On the server side, one socket is used for listening, the others are used for communicating with the client.
My question is: if i want to set option for socket, which socket should be set on?
If either can be set, what's the different?
Again, what's the different if set option... (1 Reply)
Discussion started by: blademan100
1 Replies
4. UNIX for Dummies Questions & Answers
:) Firstly Hi all!!, im NEW!! and on here hoping that someone might be able to offer me some help... i have a server that keeps crashing every few days with the error message:
PANIC KERNAL-MODE ADDRESS FAULT ON USER ADDRESS 0X14
KERNAL PAGE FAULT FROM (CS:EIP)=(100:EF71B5BD)
EAX=EF822000... (10 Replies)
Discussion started by: Twix
10 Replies
5. Programming
Why does this socket function only read the first 1440 chars of the stream. Why not the whole stream ? I checked it with gdm and valgrind and everything seems correct...
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include... (3 Replies)
Discussion started by: cyler
3 Replies
6. Programming
Dear Experts,
i am compiling my code in suse 4.1 which is compiling fine,
but at runtime it is showing me for socket programming error no 88
as i searched in errno.h it is telling me socket operation on non socket,
what is the meaning of this , how to deal with this error , please... (1 Reply)
Discussion started by: vin_pll
1 Replies
7. IP Networking
Hi there
I lost connectivity to one of our remote systems and when I checked the messages log I found the following:
Aug 10 23:42:34 host xntpd: time reset (step) 1.681729 s
Aug 16 13:20:51 host ip: WARNING: node "mac address" is using our IP address x.x.x.x on aggr1
Aug 16 13:20:51 host... (9 Replies)
Discussion started by: notreallyhere
9 Replies
8. IP Networking
I need clarification on whether it is okay to set socket options on a listening socket
simultaneously when it is being used in an accept() call?
Following is the scenario:-
-- Task 1 - is executing in a loop - polling a listen socket, lets call it 'fd', (whose file descriptor is global)... (2 Replies)
Discussion started by: jake24
2 Replies
9. Programming
Hi ,
I am getting error in bind function of "Address already in use" even also i have used the setsockopt function in that case .
Please help
int ret = 0;
int listenSock = 0;
struct sockaddr_in myAddr;
struct sockaddr_in ... (1 Reply)
Discussion started by: vipin auja
1 Replies
10. UNIX for Advanced & Expert Users
Hi ,
Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies
LEARN ABOUT MOJAVE
getsockname
GETSOCKNAME(2) BSD System Calls Manual GETSOCKNAME(2)
NAME
getsockname -- get socket name
SYNOPSIS
#include <sys/socket.h>
int
getsockname(int socket, struct sockaddr *restrict address, socklen_t *restrict address_len);
DESCRIPTION
The getsockname() function returns the current address for the specified socket.
The address_len parameter should be initialized to indicate the amount of space pointed to by address. On return it contains the actual size
of the address returned (in bytes).
The address is truncated if the buffer provided is too small.
RETURN VALUES
The getsockname() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to
indicate the error.
ERRORS
The getsockname() system call will succeed unless:
[EBADF] The argument socket is not a valid file descriptor.
[EFAULT] The address parameter points to memory not in a valid part of the process address space.
[EINVAL] socket has been shut down.
[ENOBUFS] Insufficient resources were available in the system to perform the operation.
[ENOTSOCK] The argument socket is not a socket (e.g., a plain file).
[EOPNOTSUPP] getsockname() is not supported for the protocol in use by socket.
SEE ALSO
bind(2), socket(2)
BUGS
Names bound to sockets in the UNIX domain are inaccessible; getsockname() returns a zero-length address.
HISTORY
The getsockname() call appeared in 4.2BSD.
4.2 Berkeley Distribution June 4, 1993 4.2 Berkeley Distribution