1. An N-nary photonic transistor (PT) structure including: a data input port, receiving a first input optical signal; a control input port, receiving a second input optical signal; an output port, outputting an output optical signal; and a nanometer-scale optical semiconductor structure photonic transistor body, comprising: (a) an active core that connects the data input port on one side and the control input port and the output port on the opposite side with the input optical signals going into the active core and the output optical signal coming out of the active core; (b) an N-InP substrate layer between the active core and the negative electrode for negative charge; (c) a P-InP layer between the active core and the positive electrode for positive charge; and (d) an insulator on each lateral side of the structure for efficient energy confinement; wherein the nanometer scale optical semiconductor structure provides functions of switching on or off between the data input port and the output port by the control signal from the control input port.