Help to run this socket program in C


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help to run this socket program in C
# 1  
Old 03-08-2010
Help to run this socket program in C

i have created two files named server and client then when i run the server program it says the server is waiting(./server 5555) then when i run the client program it says "client error:connection refused" can u plz help me to run it?Smilie
# 2  
Old 03-08-2010
post a snippet of those parts of your code
pertaining to and including your call to connect.

anyone who knows about socket programming, it's been a while for me Smilie,
will most likely be able to pick out the error there, if any.
# 3  
Old 03-08-2010
thats my code

thats my attachment plz try to debug it and tell me the result
# 4  
Old 03-08-2010
Hello,

You are most likely using the wrong port number with the client.
Format: #./client <server-address> <port-number>

If the server is running on the same machine then use server address as 127.0.0.1 and always use right port number( which you are making the mistake at)

If this still doesnt work, then make a sanity check if the server is running by

Code:
pgrep server_binary_file

If it returns a valid integer then the server is running or else you need to.

Regards,
Gaurav.
# 5  
Old 03-08-2010
and whats the port number?
# 6  
Old 03-08-2010
Hello,

Have you read anything about server and their port numbers.? I would suggest that you do some reading before asking questions here.
# 7  
Old 03-08-2010
actully i did it like this ./client 127.0.0.1 9734 and stil can not by the way i'm running linux ubuntu and what should the output looks like anyway?

---------- Post updated at 06:17 PM ---------- Previous update was at 06:15 PM ----------

well i did read but alil confuse i'm sorry dude for bothering
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

C socket program on UNIX

Write a C socket program on UNIX where a TCP client sends/reads a time in decimal 24 hours format to the server and the server echoes the seconds, minutes, and hours in the time. Example: Client sends 18.78 hours and the server displays 18 hours, 46 minutes and 48 seconds. (1 Reply)
Discussion started by: adi_always4u143
1 Replies

2. AIX

Sample C program to Send/Recieve a file using Socket

Hi All, I urgently need a Sample C program to Send/Recieve a file using Socket. Thanks Sara (1 Reply)
Discussion started by: saraperu
1 Replies

3. Programming

Problem with Socket program..

I wrote a program which will send a message to multiple clients(i.e, broadcasting) that are connected to a server.Once when the client receives a message from the server ,the client should read a file in the server and display it in the client.The client which responds (i.e, client wants all the... (3 Replies)
Discussion started by: vigneshinbox
3 Replies

4. Shell Programming and Scripting

socket program

All, I am looked to develop a socket program from one Solaris server to another Solaris server to send UDP packets from a source UDP port number 2505 on the first server to the source port 2505 on the second server. Is it possible to do? What is the best way to do this? I want to set the... (1 Reply)
Discussion started by: bubba112557
1 Replies

5. Programming

How to Run a Linux Command and Redirect its output to a socket in C

I have a Linux socket server program. I need to run the commands sent by the client and return the output to client. Is there a quicker way? I tried with ptr=popen(command, "r"); and then fgets(buf, size,ptr); write buf to socket fgets hangs for me. Now, I would like to know if I can... (3 Replies)
Discussion started by: rajeshomallur
3 Replies

6. UNIX for Advanced & Expert Users

Fedora Linux for Socket Program Development

Hi, I am trying to port a networking application to linux, I get error while binding a socket to a port, The port is not used by any application and was verified by using netstat and other tools. I tried a simple socket and bind on a unused port, but even that fails. Is there any document... (0 Replies)
Discussion started by: venkatesh.n
0 Replies

7. Programming

Help Socket program

Hi All, I'm writing a client-server socket program. the client will be an instance of the well-known telnet application. i want to implement a simple authentication between the server and the client. - the client should send this message (after the connection established): my password... (0 Replies)
Discussion started by: mhetfield
0 Replies

8. Programming

how to run socket programme and file management concurrently

hi i have a server socket programme which is running in HP/UX system and then need to add a function about refreshing memory every miniute because the socket programme is blocked , i have no idea about this what should i do thanks (10 Replies)
Discussion started by: benbenpig
10 Replies

9. UNIX for Dummies Questions & Answers

Getting a program to run

Please help, I have tried to run this program countless times and still nothing. Please tell me what I'm doing wrong. $ cat>test count=1 while do echo "5" read number echo $5 let count=count+ 1 done exit 0 ^C$ ksh test $ ^C $ ksh test $ $ nothing happend (6 Replies)
Discussion started by: ctiamaria
6 Replies

10. Programming

How can I program socket in unix?

Excuse me . I'm a beginner . In windows , MFC can be used , but how to do in Unix ? And does unix support c++like VC++ ? How can I get developing tools in Unix ? (7 Replies)
Discussion started by: sanjohn
7 Replies
Login or Register to Ask a Question