Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Jose Juan Montiel
    @josejuanmontiel
    imagen.png
    can put inside thread :(
    Andy Pan
    @panjf2000
    are you working on Windows? gnet v2 doesn’t support Windows.
    Luiz Menniti
    @Menniti
    Ahh that's the same problem I have!
    I will change the OS then, thanks Andy
    Andy Pan
    @panjf2000
    You’re welcome, sorry for the delay, kind of busy at daytime
    kant777
    @kant777
    it seemed that your server was writing data heavily while your client didn't receive duly.
    @panjf2000 in that case, how can I prevent OOM while maintaining low latency(since this is extremely important for me)? is there a way in gnet to say discard or simply timeout after 5ms so I can prevent OOM? With ring buffer I thought I would never run into OOM. can you please share some light here
    Andy Pan
    @panjf2000
    you can just stop writing data to client when there are tons of bytes stuck in buffer.
    Luiz Menniti
    @Menniti

    Hello guys, I`m having issues implementing the UDP protocol in gnet, maybe someone could help me ?

    I open the connection, and Im trying to write it from my go routine inside of UDP server, then, Im expecting to read this information from other client from UDP server

    The error I got is this: write udp 127.0.0.1:37666->127.0.0.1:9000: use of WriteTo with pre-connected connection
    0

    image.png
    image.png
    image.png
    Andy Pan
    @panjf2000
    Which gnet API are you calling to get this error?
    I assume that you are getting this error by calling the API of golang standard "net" API instead of gnet API?
    Luiz Menniti
    @Menniti
    Yes, correct I`m using net API, should I use gnet.NewClient to write into my UDP connection?
    Luiz Menniti
    @Menniti
    So, I have implemented the gnet.NewClient and I could write into it, seems to works fine. Thankss
    image.png
    But now, what I`m trying to do is listen all those events inside of func Ontrafic() from some external client reader, but for some reason I cannot listen to it.
    I was using write function to send messages to clients connected, Any Ideas I would appreciate
    Andy Pan
    @panjf2000
    You don't have to use gnet.Client, it's event-driven that is a little bit complex, you can still use net API, just need to resolve the "connected" UPD issue and set the UDP socket to non-blocking
    one principle is that you should never be blocking in OnTraffic()
    Luiz Menniti
    @Menniti

    Hmm still confusing I believe... So what I have is:

    When I write data into my gnet server, it works fine! using gnetClient or using External UDP client

    But when I want to read the information that pass inside of OnTrafic(), I cannot handle it (using external client for example)

    Andy Pan
    @panjf2000
    Please provide a full example code and I will check it out after work.
    Luiz Menniti
    @Menniti
    image.png
    There is my main function where my server has started
    I also add the gnetClient inside of my bigData struct, as you can see above

    image.png
    Now, there is my streaming function, where I will receive data from the callback trades, and also the I open a gnetClient UDP, and start to write to it
    Luiz Menniti
    @Menniti

    image.png
    image.png
    There is my server protocol, and also the results of OnTrafic, so there I can print every trade that got written by gnetClient inside of streaming function

    image.png
    And here is my simple external client, that I was expecting to Listen the events from the server 0.0.0.0:9000 / 127.0.0.1:9000
    Andy Pan
    @panjf2000
    Sorry, I'm busy this week, I will check this issue out on the weekend
    Luiz Menniti
    @Menniti
    Sure @panjf2000 don`t worry is totally fine
    Thanks for your support in advance
    coldice005
    @coldice005
    @panjf2000 你好有没有计划支持一下 quic 模式?
    Andy Pan
    @panjf2000
    At the moment I do not have time to support QUIC for the time being, there may be plans for the second half of this year
    Andy Pan
    @panjf2000
    @Menniti could you put your code in a github repository and share it with me? it's a bit inconvenient for me to read the code in several pictures.
    Luiz Menniti
    @Menniti
    @panjf2000 Sure no problem at all
    Nichole
    @NicholeGit
    image.png
    image.png
    这个pool有什么用,没看出来可以提高什么性能?
    sopp
    @javasopp
    老哥,请问下,udp主动推送,我看会自动执行releaseUDP这个方法,然后怎么都无法通过gnet.conn进行推送,请问这个要怎么处理呢?谢谢
    @panjf2000
    Noah
    @noahsilverman

    Hello :)

    I'm new to gnet

    In the documentation, it describes two kinds of workflow:

    • Multiple Reactors
    • Multiple Reactors + GoRoutine Pool

    How can I choose which workflow?
    Is there any benefit to one or the other?
    For the GoRoutine Pool, how can I specify pool size, etc. (the ant options)?

    For context: I want to make a websocket re-broadcaster:
    • Subscribe to 3-4 websocket streams
    • Re-broadcast those streams to many clients (Each client can sub and unsub the streams they want)
    Young
    @xiuyoung89
    大佬有没有微信群?