473,385 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

TCPIP socket client programming in redhat linux using Eclipse CDT

This is my sample socket tcp ip program , problem here is when i give working ip address and port number, it is showing default ip address as 127.0.0.1 and it is Waiting on (1978=port number) i.e., "connection on %d...", SERVER_PORT.


Expand|Select|Wrap|Line Numbers
  1. void socket_server_demo(void){
  2. int iserver_socket = -1;
  3. int iclient_socket = -1;
  4. unsigned char bTemp[1024];
  5. unsigned int iTemp = 0;
  6. int i;
  7. int active_net = 0;
  8. char client_addr[255];
  9. unsigned int client_port = 0;
  10. char iflist[16][IFNAMSIZ];
  11. struct ifreq ifr;
  12. int error;
  13. printf(ALG_CENTER, "socket server");
  14. iTemp = netif_get_list(iflist, sizeof(iflist)/IFNAMSIZ);
  15. for (i = 0; i < iTemp; i++){
  16. memset(&ifr, 0, sizeof(ifr));
  17. netif_get_flags(iflist[i], &ifr);
  18. if (ifr.ifr_flags & IFF_RUNNING){
  19. netif_get_ipaddr(iflist[i], &ifr);
  20. printf(ALG_CENTER, "Address:%s:%d", inet_ntoa(((structsockaddr_in*)&ifr.ifr_addr)->sin_addr), SERVER_PORT);
  21. active_net++;
  22. }}
  23.  
  24. if (active_net == 0){
  25. printf(ALG_CENTER, "NO Active net work");
  26. kb_getkey();
  27. return;}
  28. server_socket = tcp_server(SERVER_PORT, 1);
  29. if (iserver_socket >=0){
  30. printf(ALG_LEFT, "Wait connection on %d...", SERVER_PORT);
Mar 16 '14 #1
1 13293
Please tell me if i did any mistake in the above code

i M not able to connect with tcp ip
Mar 22 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Krzysztof Pa¼ | last post by:
Hi, I want to make simple client in phyton, which would be able to communicate with Java server using SSL sockets. There is the Java clients, which is doing this - so I'm pretty sure, that Java...
3
by: Matthew King | last post by:
Hi all I've written a asynchronous socket client class, but i've found that in order to consume it I have to use events, and cannot simply for example SocketClient client = new...
2
by: johnfofawn | last post by:
Hi, I'm using Eclipse to do Javascript. I'd really like an IDE with a good built-in help system for Javascript (something like Visual Studio). Do you know of anything like this? I'm working...
13
by: Sandeep Singh | last post by:
I am making socket client application in C# how can i get ip address of client who has connected to server
7
by: Ole | last post by:
Hi, I'm going to develop a socket communication between an instrument (running CE 5.0 with Compact Fraework V2) and a PC. As the instrument should only connect to one PC at a time I believe that...
11
by: juyi520 | last post by:
Hello, I am new in C in Programming, Where could I find the detail about struct FILE in RedHat Linux ? I have tried to check the stdio.h in /usr/include, but I could not find the
0
by: shonen | last post by:
I'm currently attempting to connect to a shoutcast server pull down the information from here and then I'll parse it. I got this working with the httplib, which was great, the problem is I want...
5
by: John Henry | last post by:
I am back against the wall trying to migrate my multithreaded application from Python 2.3 to 2.5. The part of the code that's failing has to do with queues (2.3 queues and 2.5 queues are not the...
1
by: RubyNovice | last post by:
User Community, I just registered on TheScripts.com and I'm looking for help building an intranet for my employer using Ruby on Rails running on RedHat Linux. I'm new to Ruby; I just purchased my...
15
by: Ramon F Herrera | last post by:
I have been using Eclipse for a few weeks, and IMO there is no better IDE. Since my experience has been so productive -and hence satisfactory- in Java, I would like to use the same IDE...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.