[HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread Billow Gao
Hi there, Is it possible to write a dynamic loaded C function as an UDP or TCP server? What we want to do it is: Add a search function which send a UDP package to remote UDP server and then listen to an UDP port, waiting for the result. Ideally, we don't close the UDP server after the search

Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread D'Arcy J.M. Cain
On Thu, 18 Oct 2007 10:55:19 -0400 Billow Gao [EMAIL PROTECTED] wrote: Is it possible to write a dynamic loaded C function as an UDP or TCP server? What we want to do it is: Add a search function which send a UDP package to remote UDP server and then listen to an UDP port, waiting for the

Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread Billow Gao
On Thu, 18 Oct 2007 10:55:19 -0400 Billow Gao [EMAIL PROTECTED] wrote: Is it possible to write a dynamic loaded C function as an UDP or TCP server? What we want to do it is: Add a search function which send a UDP package to remote UDP server and then listen to an UDP port, waiting for the

Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread D'Arcy J.M. Cain
On Thu, 18 Oct 2007 11:24:24 -0400 Billow Gao [EMAIL PROTECTED] wrote: I can write the network program. But I am not 100% sure whether I can add the c-language function ( http://www.postgresql.org/docs/8.2/interactive/xfunc-c.html) to PostgreSQL. The function will be dynamic loaded by

Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread Gregory Stark
D'Arcy J.M. Cain [EMAIL PROTECTED] writes: On Thu, 18 Oct 2007 11:24:24 -0400 And use it in PostgreSQL like: = SELECT name, c_talktoremoteudp(emp, 1500) AS overpaid FROM emp WHERE name = 'Bill' OR name = 'Sam';

Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread Billow Gao
Thanks. This is what I want to know :-) Regards, Billow Yeah, what he wants is to implement a function in Postgres which does something like an LDAP or DNS lookup or something like that. Sure you can do this. The only tricky bit is the thing you mentioned about reusing the connection. You

Re: [HACKERS] Can a C function(server program) be a UDP or TCP server?

2007-10-18 Thread Jan de Visser
On Thursday 18 October 2007 12:27:59 Billow Gao wrote: Thanks.  This is what I want to know :-) Regards, Billow Yeah, what he wants is to implement a function in Postgres which does something like an LDAP or DNS lookup or something like that. Sure you can do this. The only tricky bit is