Quantcast

How to save Socket data in ETS

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to save Socket data in ETS

Dmitry
Hello,

What is correct way to save tcp socket data in ETS?

I tried this way:

ets:insert(socket, {"79514484992",#Port<0.11255>}), But it gives "syntax error".

When I place commas around - everything is ok:

ets:insert(socket, {"79514484992",'#Port<0.11255>'}) - this is ok, but how to add commas around Port?




_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to save Socket data in ETS

Hynek Vychodil
Hi,
Do not type it in Erlang shell but use variable bound to Port. #Port<0.11255> is a way how Erlang visualize Port value but it is not a Port value. You can't make Port from "#Port<0.11255>" which is what Erlang shell received from your keyboard. You have to use what Erlang shell received from (erlang:)open_port/2 and then transformed to "#Port<0.11255>" and sent to IO server which shows it to the terminal. You have to bound it to the variable or use v(N) pseudofunction.
Hynek Vychodil

On Wed, Mar 29, 2017 at 7:28 AM Dmitry <[hidden email]> wrote:
Hello,

What is correct way to save tcp socket data in ETS?

I tried this way:

ets:insert(socket, {"79514484992",#Port<0.11255>}), But it gives "syntax error".

When I place commas around - everything is ok:

ets:insert(socket, {"79514484992",'#Port<0.11255>'}) - this is ok, but how to add commas around Port?



_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...