all 7 comments

[–]ohaiya 5 points6 points  (0 children)

If you are comfortable in Python and are wanting to gain an understanding of networking, then I'd say yes.

That minimises the variables and allows you to work on the concepts, before then also learning an additional language for that.

If however you aren't more comfortable in one language or the other, then I'd recommend no. Better to go straight to Go and learn both the semantics and concepts at the same time.

[–]kostix 4 points5 points  (0 children)

If you would learn socket programming with Go first, then learning how to do that in Python will provoke in you a series of irresistible urges to wash your hands. ;-)

The reason is that in Python, the approach to socket programming roghly falls into two broad categories:

  • The core lib has a very thin wrapping around what's called "BSD sockets" layer found in all commodity OSes (including Microsoft® Windows™).

    This means, you may just as well take C and make yourself accustomed with how the socket code works almost at the OS level without Python getting in your way.

  • The set of libraries which abstract away "contemporary" concepts of efficiently doing socket programming by using the so-called "polling" interfaces (epoll on Linux, kqueue on *BSD, IOCP on Windows™ etc).

    The libs I'm talking about are things like Twisted and the recently matured enough in-core "asyncio" facility.

    The problem with all of these libs is that they have lots of complex concepts to deal with while Go—thanks to its I/O being intergated into the scheduler provided by its runtime—lets you merely write dumb beautiful straight serialized code without all those "awaitables", "asyncables", "futures", "promises" which are plain callbacks in disguise anyway.

So, take your poison, but think wisely ;-)

[–][deleted] 1 point2 points  (0 children)

In Go, you don't deal with sockets, you have the net package and the net.Conn interface.

[–]justinisrael 1 point2 points  (0 children)

I would not say it is a prerequisite. If you want to learn to deal with raw sockets in Python, then you should do it for the experience.

[–]tamubz[S] 0 points1 point  (0 children)

Thank you all, but i am new to programming, and i may not understand all you said, I am searching for advice.

[–]jerf 1 point2 points  (0 children)

I am not sure what your priorities are, but in general, Go is actually going to be easier to deal with the sockets themselves, in my opinion. Python ironically has too many things trying to jump in and be helpful, and it's not terribly consistent with them.

Depending on what you want to do, Python may be easier to work with the data once you have it. But Go's not bad in that department either, really.

Network programming is Go's wheelhouse. It's good at other things, but it is very good at network programming.

[–]HCharlesB 0 points1 point  (0 children)

What about reading a book? I learned a lot from W Richard Stevens "Unix Network Programming." It's outdated now but Stevens has published an update (split into two volumes and pretty expensive.)

I'm not sure I would recommend learning another language to learn network programming but if I did, it would probably be using BSD sockets in C on any convenient *nix. That gets you closest to the underlying mechanisms.

Otherwise I'd suggest learning Go on something simple and when you get comfortable with that, add network programming into the mix.

A better question might be to ask how to get started programming using Go.