Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 Is there any way we can create the apps as a serve

views
     
TSmohamadfaris92
post Nov 7 2018, 04:19 PM, updated 6y ago

New Member
*
Newbie
7 posts

Joined: Nov 2018


Is there any way we can create the apps as a server and client in the same time ? such as socket.io wrapper?
malleus
post Nov 7 2018, 09:57 PM

Look at all my stars!!
*******
Senior Member
2,096 posts

Joined: Dec 2011
the answer is definitely a yes, but whether its a good idea or not depends on the exact implementation, which in turn depends on what exactly you're trying to do
bumpo
post Nov 13 2018, 03:12 PM

On my way
****
Junior Member
632 posts

Joined: Mar 2013


open a socket and listen to a port and you have a "server"
open a connection and connect to someone's port and you have a "client"

you cannot do both of this on one thread and need different threads.
this means as long as the platform you are running on supports multi threading then you can have both server and client as one app

how feasible it would be is a different discussion all together laugh.gif
TSmohamadfaris92
post Nov 22 2018, 01:52 PM

New Member
*
Newbie
7 posts

Joined: Nov 2018


QUOTE(bumpo @ Nov 13 2018, 03:12 PM)
open a socket and listen to a port and you have a "server"
open a connection and connect to someone's port and you have a "client"

you cannot do both of this on one thread and need different threads.
this means as long as the platform you are running on supports multi threading then you can have both server and client as one app

how feasible it would be is a different discussion all together  laugh.gif
*
Thanks for the reply. smile.gif
Lord Tiki Mick
post Dec 11 2018, 06:46 PM

Regular
******
Senior Member
1,018 posts

Joined: Jul 2012
QUOTE(bumpo @ Nov 13 2018, 03:12 PM)
open a socket and listen to a port and you have a "server"
open a connection and connect to someone's port and you have a "client"

you cannot do both of this on one thread and need different threads.
this means as long as the platform you are running on supports multi threading then you can have both server and client as one app

how feasible it would be is a different discussion all together  laugh.gif
*
Don't HTTP/2 or websocket allows bidirectional communication? I reckon it should be possible to do it in a single thread. hmm.gif
bumpo
post Dec 11 2018, 08:09 PM

On my way
****
Junior Member
632 posts

Joined: Mar 2013


QUOTE(Lord Tiki Mick @ Dec 11 2018, 06:46 PM)
Don't HTTP/2 or websocket allows bidirectional communication? I reckon it should be possible to do it in a single thread. hmm.gif
*
Not too familiar with http2 but even if the connection can be reused to send/recv but listner and sending would need different thread no? Kinda like a main thread that spawns additional thread to handle send/recv.
But yea, would be interesting to see if can be packed into just 1 thread. You up to the challenge?
Lord Tiki Mick
post Dec 12 2018, 02:53 AM

Regular
******
Senior Member
1,018 posts

Joined: Jul 2012
QUOTE(bumpo @ Dec 11 2018, 08:09 PM)
Not too familiar with http2 but even if the connection can be reused to send/recv but listner and sending would need different thread no? Kinda like a main thread that spawns additional thread to handle send/recv.
But yea, would be interesting to see if can be packed into just 1 thread. You up to the challenge?
*
It definitely can be done! Provided that it's sequencial, or using coroutine and a protocol needs to be defined so that either side of the communication knows when to send or recv.
takemehomepls
post Dec 12 2018, 02:58 AM

Getting Started
**
Junior Member
124 posts

Joined: Oct 2012
From: Cosmopolitan


QUOTE(mohamadfaris92 @ Nov 7 2018, 04:19 PM)
Is there any way we can create the apps as a server and client in the same time ? such as socket.io wrapper?
*
Is Pusher applicable in this case? Sorry I am kinda noob
bumpo
post Dec 18 2018, 07:30 AM

On my way
****
Junior Member
632 posts

Joined: Mar 2013


QUOTE(Lord Tiki Mick @ Dec 12 2018, 02:53 AM)
It definitely can be done! Provided that it's sequencial, or using coroutine and a protocol needs to be defined so that either side of the communication knows when to send or recv.
*
hahaha you just very roughly described the walkie talkie laugh.gif laugh.gif

 

Change to:
| Lo-Fi Version
0.0144sec    0.49    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 02:27 PM