tanks for your answer
my professor said that when we want to connect to computer, the maximum distance should be 50 meters because the maximum cable length in star topology is 100 meters and when we ping a computer the packet sent should return to source computer then the distance is 50*2=100
but on the other hand when we have to computer and a hub between them, the maximum distance between first computer and hub should be 100 meters and the hub and second computer 100 meters too.
now why? in second Scenario if we want to ping a computer like the first Scenario the request sent can not return back to source computer because
100 meters from hub to second computer 100*2=200 and the maximum length is 100 meters.
whats the reason?
I may have given too general an answer, and I assumed that you were using 'hub' to mean 'switch'. There are different rules for hubs/repeaters than for switches/bridges. In a practical sense, hubs/repeaters are almost never used anymore, switches/bridges are used instead. That being said, an academic understanding of shared-media Ethernet is actually helpful for a deeper understanding of networking. (all the timing rules related to collision detection and preamble consumption, and all the details that I no longer remember)
That being said, even assuming shared-media Ethernet (hubs/repeaters), if you have two computers with one network cable directly connecting them, that is 1 segment with 2 stations on it, and 100 meters is correct.
In your ping example, the frame containing the ping travels from Computer1 across the cable to Computer2, and is consumed. Computer2 then drops a reply frame on the cable, it travels back to Computer1 and is consumed. This is assuming twisted-pair. If you have a coax network (obsolete, but academically interesting) the frames are not consumed by the stations, but are instead consumed (literally converted to a tiny amount of heat) in the terminating resistors at each end of the coax cable. The frame containing the ping doesn't just 'bounce' off the target computer - it is actively responded to.
I don't know if I made it better of worse for you with my explanation, but I hope I helped.