Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 03-13-2004, 01:00 AM   #1
LQ Newbie
Registered: Mar 2004
Location: Kansas City MO USA
Posts: 2

Rep: Reputation: 0
Unhappy tcp-echo server- bind() returns -1

/* Bind the socket */
if (bind(socket_descr, (struct sockaddr *)&sin,((socklen_t))sizeof(sin))< 0)
{printf("Can't bind to %s port! \n", service);}
if (type == SOCK_STREAM && listen(socket_descr, length)<0)
{printf("Can't listen on %s port! \n", service);}


i am trying to write tcp-echo server but it says it cant bind to echo port...

what could be the possible error ?

thanks in advance !
Old 03-15-2004, 12:21 PM   #2
LQ Newbie
Registered: Mar 2004
Distribution: Red hat Linux 8.0
Posts: 9

Rep: Reputation: 0
check port numbers of both client and server.The port numbers must be same.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bind returns 0 answers on the zone it is set to be master on Timur Sakayev Linux - Networking 2 12-29-2004 08:46 AM
sun-dr/tcp: bind: Address already in use choonseng Solaris / OpenSolaris 2 10-18-2004 02:48 AM
Bind returns -1 slackwarefan Programming 18 05-31-2004 12:36 AM
echo stuff i want to have returns SpeedDingo Linux - Newbie 2 05-15-2004 12:09 PM
Microsoft ISA Firewall Returns Port Scan Warnings From Linux BIND DNS Servers. ramram29 Linux - Security 4 01-26-2004 10:09 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration