473,396 Members | 1,816 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,396 software developers and data experts.

Server listening on 2 differents ports

I am trying to program a server in C for UNIX to get a kind of "bridge"
between the clients of a port A and the clients of a port B.
For that, I create 2 processes: one that listen the requests of port A
clients and another for the Port B ones.

In each process, when a connetion service is required, after accepting
, the value of the socket generated is added to a set of sockets. This
set keeps on listening on each socket for new messages to be read.

the question is that both processes get the same socket values, I
mean, the first client asking on port A get the same socket number that
the first one on port B. So I can not refer to a client in a unique way
, because there will be 2 clients with the same socket number .

I am using fork(), and in each process created, I use a method in
charge of creating the set of sockets and waiting for some event. I
suspect that the use of fork() is not right in this situation.........
In other words: If there is anybody who could know how to program a
server which is going to receive messages on 2 diferents ports and it
has to carry them from one port to another ( both ways), please, please
help me.
Thanks a lot !
(Sorry about my english)

Nov 15 '05 #1
3 2316
On Tue, 05 Jul 2005 04:16:27 -0700, ssantamariagarcia wrote:
I am trying to program a server in C for UNIX to get a kind of "bridge"
between the clients of a port A and the clients of a port B.
For that, I create 2 processes: one that listen the requests of port A
clients and another for the Port B ones.

In each process, when a connetion service is required, after accepting
, the value of the socket generated is added to a set of sockets. This
set keeps on listening on each socket for new messages to be read.


Your question is about Unix and socket programming which are not covered
by the C language itself. A good newsgroup to ask your question is
comp.unix.programmer.

Lawrence

Nov 15 '05 #2
I' ll try there. Thanks a lot

Sonia

Nov 15 '05 #3
ss***************@hotmail.com wrote:

I am trying to program a server in C for UNIX to get a kind of
"bridge" between the clients of a port A and the clients of a
port B. For that, I create 2 processes: one that listen the
requests of port A clients and another for the Port B ones.
.... snip ...
(Sorry about my english)


Your English is satisfactory, your choice of newsgroups is not.
The C language knows nothing about ports, processes, clients,
forks, etc. You want a newsgroup that deals with those things.
Something with one of posix, linux, unix in its name seems
suitable.

Before posting there stop and read several days, or a weeks, worth
of postings. This should give you a strong feeling for whether or
not your query is topical. Read any welcome or FAQs associated
with the group.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Oliver Klozoff | last post by:
Hi, I am having a hard time setting up an SQL Server 2000 Developer Edition instance for remote clients. The instance is running well and I can connect to it on the local computer. When I try...
5
by: pb648174 | last post by:
If I am doing an Index Server query from SQL, such as: SELECT Q.* FROM OPENQUERY(FTIndexPM, ''SELECT path, characterization, rank, hitcount FROM SCOPE('DEEP TRAVERSAL OF ..... can anyone tell...
4
by: Xarky | last post by:
Hi, I am writing a small web server, to listen on web browser port(8080), if I'm not wrong. Basically for parsing some tags found in html. Now I am doing as follows TcpListener mainTcp =...
17
by: Danieltbt05 | last post by:
just installed SQL server 2000 and using my client , i can't locate the server. I used SQL query analyzer to search but no servers were found. Error message is as below Server : Msg17,level...
1
by: Alexandre (www.pointnetsolutions.com) | last post by:
I am looking at building a distributed system, and i have been looking at many different options, in some cases i was thinking of a client server relation where a client would send a string to...
1
by: abhi147 | last post by:
Hi , I have a basic socket program with a server listening in a while loop and one client . Now I want to have 3 servers on listening mode with one client sending the data (kind of load balancing)...
1
by: Alex | last post by:
Hi, I have written a caller ID software working true HTTP. But there is a disadvantage: it checks every second true http the last caller. Changing it to for example check every 10...
9
by: Cathy | last post by:
I am using a System.Data.SqlClient.SqlConnection to connect to a SQL Server 2005 database. I instantiate the SqlConnection with a connection string... SqlConnection sqlConn = new...
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: 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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.