* [gentoo-user] Tcp Listener @ 2014-02-03 18:15 xarman 2014-02-03 19:05 ` [gentoo-user] " Grant Edwards ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: xarman @ 2014-02-03 18:15 UTC (permalink / raw To: gentoo-user I'm interested in making a TCP Listener in C / C++ on Linux to accept many connections simultaneously. I did a relative search on the Web and although I am aware of the C language as to a certain extent, I struggle to find a model program. Essentially, it is the listener of a server that receives a signal and stores it in a database and do some other functions. I know how to do the functions but I'm looking for a way to fix the basic skeleton of listener that will be always active. I'm not sure if I need multi threading or multi socketing for multi connections. If you have any knowledge on the subject or have a simple example or even some reference in order to work on that, I'd appreciate it. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [gentoo-user] Re: Tcp Listener 2014-02-03 18:15 [gentoo-user] Tcp Listener xarman @ 2014-02-03 19:05 ` Grant Edwards 2014-02-03 21:43 ` [gentoo-user] " Alan McKinnon 2014-02-06 11:08 ` 钱泽森 2 siblings, 0 replies; 11+ messages in thread From: Grant Edwards @ 2014-02-03 19:05 UTC (permalink / raw To: gentoo-user On 2014-02-03, xarman <manousidis.xar@gmail.com> wrote: > I'm interested in making a TCP Listener in C / C++ on Linux to accept > many connections simultaneously. I did a relative search on the Web and > although I am aware of the C language as to a certain extent, I > struggle to find a model program. My initial advice would be to use Python instead of C. If you want to use C: man socket man select man poll man pthreads http://en.wikipedia.org/wiki/POSIX_Threads http://www.amazon.com/UNIX-Network-Programming-Richard-Stevens/dp/0139498761 http://www.amazon.com/Advanced-UNIX-Programming-2nd-Edition/dp/0131411543 -- Grant Edwards grant.b.edwards Yow! My mind is a potato at field ... gmail.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Tcp Listener 2014-02-03 18:15 [gentoo-user] Tcp Listener xarman 2014-02-03 19:05 ` [gentoo-user] " Grant Edwards @ 2014-02-03 21:43 ` Alan McKinnon 2014-02-03 21:51 ` xarman 2014-02-06 11:08 ` 钱泽森 2 siblings, 1 reply; 11+ messages in thread From: Alan McKinnon @ 2014-02-03 21:43 UTC (permalink / raw To: gentoo-user On 03/02/2014 20:15, xarman wrote: > I'm interested in making a TCP Listener in C / C++ on Linux to accept > many connections simultaneously. I did a relative search on the Web and > although I am aware of the C language as to a certain extent, I > struggle to find a model program. Essentially, it is the listener of a > server that receives a signal and stores it in a database and do some > other functions. I know how to do the functions but I'm looking for a > way to fix the basic skeleton of listener that will be always active. > I'm not sure if I need multi threading or multi socketing for multi > connections. > If you have any knowledge on the subject or have a simple example or even > some reference in order to work on that, I'd appreciate it. > > Is this a school homework question? -- Alan McKinnon alan.mckinnon@gmail.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Tcp Listener 2014-02-03 21:43 ` [gentoo-user] " Alan McKinnon @ 2014-02-03 21:51 ` xarman 2014-02-03 22:04 ` William Kenworthy 2014-02-03 23:20 ` Alan McKinnon 0 siblings, 2 replies; 11+ messages in thread From: xarman @ 2014-02-03 21:51 UTC (permalink / raw To: gentoo-user On 02/03/2014 11:43 PM, Alan McKinnon wrote: > On 03/02/2014 20:15, xarman wrote: >> I'm interested in making a TCP Listener in C / C++ on Linux to accept >> many connections simultaneously. I did a relative search on the Web and >> although I am aware of the C language as to a certain extent, I >> struggle to find a model program. Essentially, it is the listener of a >> server that receives a signal and stores it in a database and do some >> other functions. I know how to do the functions but I'm looking for a >> way to fix the basic skeleton of listener that will be always active. >> I'm not sure if I need multi threading or multi socketing for multi >> connections. >> If you have any knowledge on the subject or have a simple example or even >> some reference in order to work on that, I'd appreciate it. >> >> > > > Is this a school homework question? > > > No. Why are you asking? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Tcp Listener 2014-02-03 21:51 ` xarman @ 2014-02-03 22:04 ` William Kenworthy 2014-02-03 23:50 ` Xar Man 2014-02-03 23:20 ` Alan McKinnon 1 sibling, 1 reply; 11+ messages in thread From: William Kenworthy @ 2014-02-03 22:04 UTC (permalink / raw To: gentoo-user On 04/02/14 05:51, xarman wrote: > > On 02/03/2014 11:43 PM, Alan McKinnon wrote: >> On 03/02/2014 20:15, xarman wrote: >>> I'm interested in making a TCP Listener in C / C++ on Linux to accept >>> many connections simultaneously. I did a relative search on the Web and >>> although I am aware of the C language as to a certain extent, I >>> struggle to find a model program. Essentially, it is the listener of a >>> server that receives a signal and stores it in a database and do some >>> other functions. I know how to do the functions but I'm looking for a >>> way to fix the basic skeleton of listener that will be always active. >>> I'm not sure if I need multi threading or multi socketing for multi >>> connections. >>> If you have any knowledge on the subject or have a simple example or even >>> some reference in order to work on that, I'd appreciate it. >>> >>> >> >> >> Is this a school homework question? >> >> >> > No. Why are you asking? > He is asking because its one of the common C/C++ computer science assignments! In practice, perl, python are usually simpler and easier to use. and the google-fu needed is to search for a TCP echo server to use as a staring point. BillK ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Tcp Listener 2014-02-03 22:04 ` William Kenworthy @ 2014-02-03 23:50 ` Xar Man 0 siblings, 0 replies; 11+ messages in thread From: Xar Man @ 2014-02-03 23:50 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 1528 bytes --] Thank you Grant and William. I wasn't aware of python programming and now that I have looked some stuff it seems indeed much simpler to implement it with. I'll look into it. On Tue, Feb 4, 2014 at 12:04 AM, William Kenworthy <billk@iinet.net.au>wrote: > On 04/02/14 05:51, xarman wrote: > > > > On 02/03/2014 11:43 PM, Alan McKinnon wrote: > >> On 03/02/2014 20:15, xarman wrote: > >>> I'm interested in making a TCP Listener in C / C++ on Linux to accept > >>> many connections simultaneously. I did a relative search on the Web and > >>> although I am aware of the C language as to a certain extent, I > >>> struggle to find a model program. Essentially, it is the listener of a > >>> server that receives a signal and stores it in a database and do some > >>> other functions. I know how to do the functions but I'm looking for a > >>> way to fix the basic skeleton of listener that will be always active. > >>> I'm not sure if I need multi threading or multi socketing for multi > >>> connections. > >>> If you have any knowledge on the subject or have a simple example or > even > >>> some reference in order to work on that, I'd appreciate it. > >>> > >>> > >> > >> > >> Is this a school homework question? > >> > >> > >> > > No. Why are you asking? > > > > He is asking because its one of the common C/C++ computer science > assignments! > > In practice, perl, python are usually simpler and easier to use. > > and the google-fu needed is to search for a TCP echo server to use as a > staring point. > > BillK > > > > [-- Attachment #2: Type: text/html, Size: 2193 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Tcp Listener 2014-02-03 21:51 ` xarman 2014-02-03 22:04 ` William Kenworthy @ 2014-02-03 23:20 ` Alan McKinnon 2014-02-03 23:50 ` Xar Man 1 sibling, 1 reply; 11+ messages in thread From: Alan McKinnon @ 2014-02-03 23:20 UTC (permalink / raw To: gentoo-user On 03/02/2014 23:51, xarman wrote: > > On 02/03/2014 11:43 PM, Alan McKinnon wrote: >> On 03/02/2014 20:15, xarman wrote: >>> I'm interested in making a TCP Listener in C / C++ on Linux to accept >>> many connections simultaneously. I did a relative search on the Web and >>> although I am aware of the C language as to a certain extent, I >>> struggle to find a model program. Essentially, it is the listener of a >>> server that receives a signal and stores it in a database and do some >>> other functions. I know how to do the functions but I'm looking for a >>> way to fix the basic skeleton of listener that will be always active. >>> I'm not sure if I need multi threading or multi socketing for multi >>> connections. >>> If you have any knowledge on the subject or have a simple example or even >>> some reference in order to work on that, I'd appreciate it. >>> >>> >> >> >> Is this a school homework question? >> >> >> > No. Why are you asking? It's worded like one, and it's your first post to this list I can find. Google the topic "do my homework for me". There's always a chance it's a genuine question though. If so, you are unlikely to get decent answers here, this is a user-based support list for users of Gentoo. Your question is better directed to forums that deal with C programming as their core topic. -- Alan McKinnon alan.mckinnon@gmail.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Tcp Listener 2014-02-03 23:20 ` Alan McKinnon @ 2014-02-03 23:50 ` Xar Man 2014-02-04 0:42 ` Korthrun 0 siblings, 1 reply; 11+ messages in thread From: Xar Man @ 2014-02-03 23:50 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 1913 bytes --] Well it's actually a project for a company that needs a tcp listener for the data sent by the devices. You are right about my question. It's a bit irrelevant with gentoo but I'm working on gentoo and I'm asking this list because I consider its users have wide knowledge on general programming. In fact I got a good suggestion and I believe my search is done. Thank you anyway. On Tue, Feb 4, 2014 at 1:20 AM, Alan McKinnon <alan.mckinnon@gmail.com>wrote: > On 03/02/2014 23:51, xarman wrote: > > > > On 02/03/2014 11:43 PM, Alan McKinnon wrote: > >> On 03/02/2014 20:15, xarman wrote: > >>> I'm interested in making a TCP Listener in C / C++ on Linux to accept > >>> many connections simultaneously. I did a relative search on the Web and > >>> although I am aware of the C language as to a certain extent, I > >>> struggle to find a model program. Essentially, it is the listener of a > >>> server that receives a signal and stores it in a database and do some > >>> other functions. I know how to do the functions but I'm looking for a > >>> way to fix the basic skeleton of listener that will be always active. > >>> I'm not sure if I need multi threading or multi socketing for multi > >>> connections. > >>> If you have any knowledge on the subject or have a simple example or > even > >>> some reference in order to work on that, I'd appreciate it. > >>> > >>> > >> > >> > >> Is this a school homework question? > >> > >> > >> > > No. Why are you asking? > > > It's worded like one, and it's your first post to this list I can find. > Google the topic "do my homework for me". > > There's always a chance it's a genuine question though. If so, you are > unlikely to get decent answers here, this is a user-based support list > for users of Gentoo. Your question is better directed to forums that > deal with C programming as their core topic. > > > > > -- > Alan McKinnon > alan.mckinnon@gmail.com > > > [-- Attachment #2: Type: text/html, Size: 2734 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Tcp Listener 2014-02-03 23:50 ` Xar Man @ 2014-02-04 0:42 ` Korthrun 2014-02-04 18:21 ` Χαράλαμπος Μανουσίδης 0 siblings, 1 reply; 11+ messages in thread From: Korthrun @ 2014-02-04 0:42 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 2230 bytes --] Check out what I consider to be a fantastic guide: http://beej.us/guide/bgnet/ On Mon, Feb 3, 2014 at 3:50 PM, Xar Man <manousidis.xar@gmail.com> wrote: > Well it's actually a project for a company that needs a tcp listener for > the data sent by the devices. You are right about my question. It's a bit > irrelevant with gentoo but I'm working on gentoo and I'm asking this list > because I consider its users have wide knowledge on general programming. In > fact I got a good suggestion and I believe my search is done. Thank you > anyway. > > > On Tue, Feb 4, 2014 at 1:20 AM, Alan McKinnon <alan.mckinnon@gmail.com>wrote: > >> On 03/02/2014 23:51, xarman wrote: >> > >> > On 02/03/2014 11:43 PM, Alan McKinnon wrote: >> >> On 03/02/2014 20:15, xarman wrote: >> >>> I'm interested in making a TCP Listener in C / C++ on Linux to accept >> >>> many connections simultaneously. I did a relative search on the Web >> and >> >>> although I am aware of the C language as to a certain extent, I >> >>> struggle to find a model program. Essentially, it is the listener of a >> >>> server that receives a signal and stores it in a database and do some >> >>> other functions. I know how to do the functions but I'm looking for a >> >>> way to fix the basic skeleton of listener that will be always active. >> >>> I'm not sure if I need multi threading or multi socketing for multi >> >>> connections. >> >>> If you have any knowledge on the subject or have a simple example or >> even >> >>> some reference in order to work on that, I'd appreciate it. >> >>> >> >>> >> >> >> >> >> >> Is this a school homework question? >> >> >> >> >> >> >> > No. Why are you asking? >> >> >> It's worded like one, and it's your first post to this list I can find. >> Google the topic "do my homework for me". >> >> There's always a chance it's a genuine question though. If so, you are >> unlikely to get decent answers here, this is a user-based support list >> for users of Gentoo. Your question is better directed to forums that >> deal with C programming as their core topic. >> >> >> >> >> -- >> Alan McKinnon >> alan.mckinnon@gmail.com >> >> >> > -- () The ASCII Ribbon Campaign - against HTML Email, /\ vCards, and proprietary formats. [-- Attachment #2: Type: text/html, Size: 3385 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Tcp Listener 2014-02-04 0:42 ` Korthrun @ 2014-02-04 18:21 ` Χαράλαμπος Μανουσίδης 0 siblings, 0 replies; 11+ messages in thread From: Χαράλαμπος Μανουσίδης @ 2014-02-04 18:21 UTC (permalink / raw To: gentoo-user on 02/04/2014 02:42 AM Korthrun wrote the following: > Check out what I consider to be a fantastic guide: > http://beej.us/guide/bgnet/ Great! Thanks much for sharing Korthrun. :) ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-user] Tcp Listener 2014-02-03 18:15 [gentoo-user] Tcp Listener xarman 2014-02-03 19:05 ` [gentoo-user] " Grant Edwards 2014-02-03 21:43 ` [gentoo-user] " Alan McKinnon @ 2014-02-06 11:08 ` 钱泽森 2 siblings, 0 replies; 11+ messages in thread From: 钱泽森 @ 2014-02-06 11:08 UTC (permalink / raw To: gentoo-user [-- Attachment #1: Type: text/plain, Size: 983 bytes --] Maybe I miss your problem.But there is a command line program names 'netcat', which can send/receive TCP/UDP messages. also would be nice to check its source code if you are interested to writing your own. 2014-02-04 xarman <manousidis.xar@gmail.com>: > I'm interested in making a TCP Listener in C / C++ on Linux to accept > many connections simultaneously. I did a relative search on the Web and > although I am aware of the C language as to a certain extent, I > struggle to find a model program. Essentially, it is the listener of a > server that receives a signal and stores it in a database and do some > other functions. I know how to do the functions but I'm looking for a > way to fix the basic skeleton of listener that will be always active. > I'm not sure if I need multi threading or multi socketing for multi > connections. > If you have any knowledge on the subject or have a simple example or even > some reference in order to work on that, I'd appreciate it. > > [-- Attachment #2: Type: text/html, Size: 1352 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-02-06 11:09 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-02-03 18:15 [gentoo-user] Tcp Listener xarman 2014-02-03 19:05 ` [gentoo-user] " Grant Edwards 2014-02-03 21:43 ` [gentoo-user] " Alan McKinnon 2014-02-03 21:51 ` xarman 2014-02-03 22:04 ` William Kenworthy 2014-02-03 23:50 ` Xar Man 2014-02-03 23:20 ` Alan McKinnon 2014-02-03 23:50 ` Xar Man 2014-02-04 0:42 ` Korthrun 2014-02-04 18:21 ` Χαράλαμπος Μανουσίδης 2014-02-06 11:08 ` 钱泽森
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox