Sponsored Content
Full Discussion: bind() error
Special Forums IP Networking bind() error Post 21832 by Virtuosso on Thursday 23rd of May 2002 11:55:03 AM
Old 05-23-2002
bind() error

Hello. I am havig problems with this program. It is a server supposed to get 2 integers from client, calculate a sum and send result back to client. I am getting a bind() error when attempting to execute it. Any help appreciated

Code:
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <string.h>

int main (void)
{
  int sd, new_sd, sum;
  struct sockaddr_un serv_addr;

  struct mystruct
  {
    int addend;
    int augend;
  } values;

  void report_fatal_error (char *message);

  sd = socket (AF_UNIX, SOCK_STREAM, 0);

  if (sd == -1)
    report_fatal_error ("Server: Cannot open socket");

  bzero ((char *) &serv_addr, sizeof (serv_addr));

  serv_addr.sun_family = AF_UNIX;

  strcpy (serv_addr.sun_path, "/tmp/mysocket");

  if (bind (sd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) == -1)
    report_fatal_error ("Server: Binding error in local address");

  listen (sd, 5);

  while (1)
  {
    new_sd = accept (sd, NULL, 0);

    if (new_sd == -1)
      report_fatal_error ("Server: Accept error");

    read (new_sd, &values, sizeof (values));

    sum = values.addend + values.augend;

    printf ("server: %d + %d = %d\n", values.addend, values.augend, sum);

    write (new_sd, &sum, sizeof (sum));

    close (new_sd);
  }
}

void report_fatal_error (char *message)
{
  perror (message);

  exit (1);
}

 

8 More Discussions You Might Find Interesting

1. Programming

ldap bind error

hi Using C program i am trying to connect to ldap server i have used the method bind syntax : ldap_bind_s(ld,"cn=Manager,dc=example,dc=com","password") but it is not able to bind and giving error as error 2 :Historical protocol version required use ldapv3 instead do i need to add any... (2 Replies)
Discussion started by: mridula
2 Replies

2. Programming

how to solve error : Bind: Address Already in Use

hi i have created socket program with proper IP address and port no client side port no 1085 and 1086 gateway side port no 1086 and 1085 and port no 1087 and 1088 receiver side port no 1088 and 1087 well it works fine on client and gateway side not on receiver and gateway side... (2 Replies)
Discussion started by: bhakti
2 Replies

3. Solaris

bind error

Hi, When I use the ldapadd command I get this error. ldap_simple_bind: Conidentiality required ldap_simple_bind: additional info: confidentiality required I was able to use this command and the ldapsearch command yesterday just fine. I think I may have made a change to a file, but I don't... (2 Replies)
Discussion started by: bitlord
2 Replies

4. Solaris

rpc/bind maintanance error

My code Hi Folks, I am getting maintanance error for rpc/bind in one of solaris 10 server.I have tried disable,enabled,cleared all options and dont no how to make online.Please help me Please find the below for details :- Server1> svcs -a rpc/bind svcs: -a ignored when used with... (0 Replies)
Discussion started by: susindram
0 Replies

5. Programming

bind source

here is the bind source file for the client.c in bind9 logs are written in var/log/file name in the form 02-Aug-2012 15:43:12.713 client 192.168.2.4#47512: query: 209.236.125.74.in-addr.arpa IN PTR + (192.168.2.4) i am in a subnet of 10 systems through 192.168.2.1..10 i want to write logs based... (2 Replies)
Discussion started by: balvinder87
2 Replies

6. UNIX for Dummies Questions & Answers

Can't bind to IP

When you get the message can't bind to ip already in use. is there a command to search to see everything that is using that IP? I've already check the host and hostname files (2 Replies)
Discussion started by: mchelle_99
2 Replies

7. Red Hat

Bind (DNS) error on EL 6.4

Gurus I have configured bind 9 on Red hat EL 6.4, it can resolve from hostname i.e from domain name (like cnn.com, bbc.com)but through IP its shows following error. Need your expert opinion to solve it. error 84.23.97.31 Server: 192.168.31.24 Address: 192.168.31.24#53 ** server can't... (1 Reply)
Discussion started by: smazshah
1 Replies

8. UNIX for Advanced & Expert Users

Bind

Hi All I need to do bind of exiting filesystem to new storage allocated mount --bind /prod/OpenCSS /var/lib/test echo "/prod/OpenCSS /var/lib/pgsql bind bind 0 0" >> /etc/fstab will this command just work ? (2 Replies)
Discussion started by: anil529
2 Replies
RSTREAM(1)							     librdmacm								RSTREAM(1)

NAME
rstream - streaming over RDMA ping-pong test. SYNOPSIS
rstream [-s server_address] [-b bind_address] [-B buffer_size] [-I iterations] [-C transfer_count] [-S transfer_size] [-p server_port] [-T test_option] DESCRIPTION
Uses the streaming over RDMA protocol (rsocket) to connect and exchange data between a client and server application. OPTIONS
-s server_address The network name or IP address of the server system listening for connections. The used name or address must route over an RDMA device. This option must be specified by the client. -b bind_address The local network address to bind to. -B buffer_size Indicates the size of the send and receive network buffers. -I iterations The number of times that the specified number of messages will be exchanged between the client and server. (default 1000) -C transfer_count The number of messages to transfer from the client to the server and back again on each iteration. (default 1) -S transfer_size The size of each send transfer, in bytes. (default 1000) If 'all' is specified, rstream will run a series of tests of various sizes. -p server_port The server's port number. -T test_option Specifies test parameters. Available options are: s | socket - uses standard socket calls to transfer data a | async - uses asynchronous operation (e.g. select / poll) b | blocking - uses blocking calls f | fork - fork server processing (forces -T s option) n | nonblocking - uses non-blocking calls v | verify - verifies data transfers NOTES
Basic usage is to start rstream on a server system, then run rstream -s server_name on a client system. By default, rstream will run a series of latency and bandwidth performance tests. Specifying a different iterations, transfer_count, or transfer_size will run a user customized test using default values where none have been specified. Because this test maps RDMA resources to userspace, users must ensure that they have available system resources and permissions. See the libibverbs README file for additional details. SEE ALSO
rdma_cm(7) librdmacm 2011-11-16 RSTREAM(1)
All times are GMT -4. The time now is 05:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy