Re: [nodejs] Re: asynchronous Socket

2012-05-30 Thread Sky Chen
Maybe you can consider socket.io, which handle most of the things for you. Here is an example: http://fbwebsocket.nodester.com/ http://socket.io/ Thanks and Regards, Sky Tim Caswell 於 2012/5/28 下午11:41 寫道: > This is a common problem porting blocking code to node. If you block on

Re: [nodejs] Re: asynchronous Socket

2012-05-28 Thread Oleg Podsechin
Common Node doesn't block since it uses fibers and there's no need to write anything C. It's also cross platform thanks to the recent support for Windows in fibers. On Monday, May 28, 2012 7:08:34 PM UTC+3, Tim Caswell wrote: > > Ok, then it will block your client. But depending on your logic t

Re: [nodejs] Re: asynchronous Socket

2012-05-28 Thread Tim Caswell
Ok, then it will block your client. But depending on your logic that may be ok. Still node doesn't have a blocking socket primitive, you would have to implement your own in C. On Mon, May 28, 2012 at 10:50 AM, Serti Ayoub wrote: > i use socket as client not as Server. > > So i will not have p

Re: [nodejs] Re: asynchronous Socket

2012-05-28 Thread Serti Ayoub
i use socket as client not as Server. So i will not have problem with blocking I/O 2012/5/28 Tim Caswell > This is a common problem porting blocking code to node. If you block on > network sockets in node, it will destroy the performance of your server. > There is only one thread. The serve

Re: [nodejs] Re: asynchronous Socket

2012-05-28 Thread Tim Caswell
This is a common problem porting blocking code to node. If you block on network sockets in node, it will destroy the performance of your server. There is only one thread. The server will be unable to serve multiple connections at once if one is blocking. Why are you porting this to node? This

Re: [nodejs] Re: asynchronous Socket

2012-05-28 Thread Oleg Podsechin
> > as an example of what i have: > >> >> var socket = new SocketSync(); >> socket.open('localhost', 8856); >> socket.write('my request'); >> var mydata= socket.read(); >> socket.end(); > > Check out the "socket" module in Common Node: https://github.com/olegp/common-node Here's the canonical ch

Re: [nodejs] Re: asynchronous Socket

2012-05-28 Thread Micheil Smith
Your best bet is possibly to write a wrapper for a wakanda/ssjs socket that makes it mimic an asynchronous node.js socket, alternatively, you could do the inverse, but it's a lot harder to do. Or, you could wrap it in promises, which would provide a potentially more unified interface, but th

Re: [nodejs] Re: asynchronous Socket

2012-05-27 Thread Eric S
On Sunday, May 27, 2012 12:51:54 PM UTC-7, Serti Ayoub wrote: > > so, what can be the solution? > Well, I can see two solutions, the first of which you've already dismissed (switching to async IO), and the second, I couldn't even begin to estimate the amount of work needed. That would be to w

Re: [nodejs] Re: asynchronous Socket

2012-05-27 Thread Serti Ayoub
the project have already be done with wakanda ssjs and it's was done with synchronous socket, and i you know asynchronous socket it's an other logic, so that will require major change in my project if i use asynchronous socket. 2012/5/27 Alan Hoffmeister > @Serti, if you don't mind about the que

Re: [nodejs] Re: asynchronous Socket

2012-05-27 Thread Alan Hoffmeister
@Serti, if you don't mind about the question, but what would be the difference for you between sync and async sockets? -- Att, Alan Hoffmeister 2012/5/27 Serti Ayoub > that's not sound good for my case. > > > 2012/5/27 Arnout Kazemier > >> Starting a new blocking child process that does the a

Re: [nodejs] Re: asynchronous Socket

2012-05-27 Thread Serti Ayoub
that's not sound good for my case. 2012/5/27 Arnout Kazemier > Starting a new blocking child process that does the async socket > operation. Shelljs has a method for blocking child process: > https://github.com/arturadib/shelljs > > On Sunday, May 27, 2012 at 9:51 PM, Serti Ayoub wrote: > > so,

Re: [nodejs] Re: asynchronous Socket

2012-05-27 Thread Arnout Kazemier
Starting a new blocking child process that does the async socket operation. Shelljs has a method for blocking child process: https://github.com/arturadib/shelljs On Sunday, May 27, 2012 at 9:51 PM, Serti Ayoub wrote: > so, what can be the solution? > > 2012/5/27 Eric S mailto:e...@geekzilla.or

Re: [nodejs] Re: asynchronous Socket

2012-05-27 Thread Serti Ayoub
so, what can be the solution? 2012/5/27 Eric S > > > On Sunday, May 27, 2012 10:26:30 AM UTC-7, Serti Ayoub wrote: >> >> >> What i need a library for using synchronous socket, so i wont to use >> event such as (on 'data' ). >> > > We understand that. The answer is that it can't be done without

Re: [nodejs] Re: asynchronous Socket

2012-05-27 Thread Eric S
On Sunday, May 27, 2012 10:26:30 AM UTC-7, Serti Ayoub wrote: > > > What i need a library for using synchronous socket, so i wont to use event > such as (on 'data' ). > We understand that. The answer is that it can't be done without making changes to node itself. What few synchronous functio

Re: [nodejs] Re: asynchronous Socket

2012-05-27 Thread Serti Ayoub
> > Thank's What i need a library for using synchronous socket, so i wont to use event such as (on 'data' ). as an example of what i have: > > var socket = new SocketSync(); > socket.open('localhost', 8856); > socket.write('my request'); > var mydata= socket.read(); > socket.end(); instead of

[nodejs] Re: asynchronous Socket

2012-05-27 Thread mscdex
On May 27, 7:35 am, Serti Ayoub wrote: > it's my first post in this group, i'm new on nodejs field. > > I have done an ssjs code with wakanda server , the code use a > synchronous socket. i want to use it in nodeJS but i dont find > synchronous Socket. You won't find synchronous network I/O in no