Hi to all,
I need a server for handle tcp and udp connections.
I have write code like follow:
if( (listenfd = tcp_listen(PORT )) == -1)
err_sys("TCP socket error");
if( (lisudpfd = udp_listen(PORT )) == -1)
err_sys("UDP socket error");
FD_ZERO(&allset );
FD_SET(listenfd , &allset);
FD_SET(lisudpfd , &allset);
for ( ; ; ) {
rset = allset;
if( (ready = select(maxfd+1, &rset, NULL, NULL, NULL)) < 0 )
err_sys("select error");
if( FD_ISSET(listen fd, &rset) ) {
/* accept TCP connection */
}
if (FD_ISSET(lisud pfd, &rset)) {
/* handling UDP connection */
printf("!!!!!!! !!!\n");
server_echo_udp (lisudpfd, (struct sockaddr *) &cliaddr,
sizeof(cliaddr) );
}
for( i = 0; i <= maxi; i++ ) {
/* handle TCP clients */
}
}
The function server_echo_udp work if invoked after the udp_listen but in
the select it never run. The select handle the tcp sockets fine.
Suggestion? 2 2263
Manuel wrote:
Hi to all,
I need a server for handle tcp and udp connections.
That's not specific to the C programming language - you'd do better
asking in a more suitable group. Perhaps one of the comp.unix
newsgroups?
<Off-topic>
IMHO, the best references for this sort of thing, complete with working
examples, are W Richard Stevens' "Unix Network Programming" texts
published by Prentice-Hall.
If you want to write this sort of code, you should get copies.
</Off-topic>
In article <Vs************ **********@twis ter1.libero.it> ,
Manuel <be****@vanilla .skywrote:
>Hi to all, I need a server for handle tcp and udp connections.
This is beyond the scope of the C programming language and therefore
off-topic for comp.lang.c.
Since the code you posted looks POSIXish, comp.unix.progr ammer might be
a good next stop. (Reading their FAQ first is probably a good idea.)
dave
--
Dave Vandervies dj******@csclub .uwaterloo.ca
I used to think -- "Hey, Java is safe. All it can do is play in the sandbox."
Darn thing went and threw a handful of sand in my face.
--Dann Corbit in comp.lang.c This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: D. Shifflett |
last post by:
Hi all,
I am having trouble with a program that ran fine on
Python 2.0 (#0, Mar 1 2001, 01:47:55)
on linux2
but will not work on
Python 2.3.2 (#1, Oct 8 2003, 17:33:47)
on linux2
|
by: RanDeep |
last post by:
I have two nodes that both exist underneath the root node. They are
linked, however, in the sense that one of the nodes contains a copy of
an id that is used to refer to the other. However, when I try create a
param using this search critieria it can never seem to locate what I
am looking for. For example, check out the following XML file:
-------------------------
<data>
<aBlock id="1">
<tmpdata>
<stringType>Hi</stringType>
|
by: Dennis M. Marks |
last post by:
I have a problem with the following code. It generates a
<FORM><SELECT><OPTION> list. There is no problem in the generating. The
problem is in the execution as follows.
It works fine in Mac IE with and without the <FORM></FORM>.
In Mac Netscape 6 the onChange does not activate if there is no
<FORM></FORM>. When I put it in a form as indicated below the value of
train.options.value is undefined. What am I doing wrong?
|
by: Tcs |
last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't
loaded it yet. I'm still using MS Access. And no, I don't believe this is an
Access question. (But who knows? I COULD be wrong... :) I've tried the
access group...twice...and all I get is "Access doesn't like ".", which I know,
or that my query names are too long, as there's a limit to the length of the SQL
statement(s). But this works when I don't try to...
|
by: Andrew McNab |
last post by:
Hi folks,
I have a problem with an MS Access SQL query which is being used in an
Access Report, and am wondering if anyone can help.
Basically, my query (shown below) gets some records from a couple of
tables in my database using INNER JOINS and the WHERE clause to
specify the required constraints. However, I also want to read two
fields from a *single* record from a table called 'Locations' and then
apply one of these field's values...
| |
by: Chris Plowman |
last post by:
Hi all,
I was wondering if anyone can help me with a really annoying problem I have
been having. I made a derived datagrid class that will select the row when
a user clicks anywhere on a cell (multi-select without modifier keys). I
got that working fine, but I also wanted to keep rows selected after a sort,
which I do by storing the row's id in an arraylist. The idea was to do the
sort and then go back and re-select the rows with that...
|
by: areef.islam |
last post by:
Hi, I am kinda new to javascript and I am having this problem with
selecting multiple options from a select tag. Hope someone can help me
out here.
here is my code
///////////////////////////////////////////////////////////////////////////////////////
<form action="whatever.php" method="post">
<select name="zip_code"
onchange="makeRequest('getCity.php?state='+this.form.zip_code.options.value)"
multiple="multiple" size="20">
|
by: imrantbd |
last post by:
This is my first problem.Please help me.
I have the following code:
<head>
<script language="JavaScript">
function addSrcToDestList() {
destList1 = window.document.forms.destList;
srcList = window.document.forms.srcList;
|
by: PinkBishop |
last post by:
I am using VS 2005 with a formview control trying to insert a record
to my access db. The data is submitted to the main table no problem,
but I need to carry the catID to the bridge table CatalogImage where
imgID also needs to be placed.
Below is my code behind to carry the catID using the Select @@Identity
and insert imgID to the bridge table.
No data is being entered into the bridge table.
|
by: djnokturnal |
last post by:
Hey guys / gals,
First time posting and of course I am sure it is something that has been answered 100 times but for some reason I just cant find the answer :)
First off here is the structure of the xml:
<Stats>
<Structure>
<Column DisplayName="GP" FieldName="GamesPlayed" Priority="1" />
<Column DisplayName="G" FieldName="Goals" Priority="2" />
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |