A portable terminal for establishing a wireless network connection, the portable terminal comprising: a communication unit; an image acquisition unit; a code image analyzer; and a controller configured to: control the image acquisition unit to capture a code image generated by a peripheral terminal wherein the code image comprises network information of the peripheral terminal, code image generation information comprising a name and a version of an automatic connection program that generated the code image, and an automatic execution program information associated with an automatic execution program to be automatically executed after code image recognition, wherein a format of the code image comprises a one-dimensional barcode format, a two-dimensional barcode format, a character string format, a numeral string format, or a color code format; control the code image analyzer to acquire network information from the captured code image; determine whether the code image is generated in a licensed program based on the code image generation information by confirming the name and the version of the automatic connection program, in response to determining that the code image is generated in the licensed program, control the communication unit to establish the wireless network connection with the peripheral terminal, in response to determining that the code image is not generated in the licensed program, control the communication unit to stop a wireless network connection process with the peripheral terminal; and after establishing the wireless network connection with the peripheral terminal using the acquired network information, to automatically execute a program corresponding to the automatic execution program information. a communication unit; an image acquisition unit; a code image analyzer; and a controller configured to: control the image acquisition unit to capture a code image generated by a peripheral terminal wherein the code image comprises network information of the peripheral terminal, code image generation information comprising a name and a version of an automatic connection program that generated the code image, and an automatic execution program information associated with an automatic execution program to be automatically executed after code image recognition, wherein a format of the code image comprises a one-dimensional barcode format, a two-dimensional barcode format, a character string format, a numeral string format, or a color code format; control the code image analyzer to acquire network information from the captured code image; determine whether the code image is generated in a licensed program based on the code image generation information by confirming the name and the version of the automatic connection program, in response to determining that the code image is generated in the licensed program, control the communication unit to establish the wireless network connection with the peripheral terminal, in response to determining that the code image is not generated in the licensed program, control the communication unit to stop a wireless network connection process with the peripheral terminal; and after establishing the wireless network connection with the peripheral terminal using the acquired network information, to automatically execute a program corresponding to the automatic execution program information. control the image acquisition unit to capture a code image generated by a peripheral terminal wherein the code image comprises network information of the peripheral terminal, code image generation information comprising a name and a version of an automatic connection program that generated the code image, and an automatic execution program information associated with an automatic execution program to be automatically executed after code image recognition, wherein a format of the code image comprises a one-dimensional barcode format, a two-dimensional barcode format, a character string format, a numeral string format, or a color code format; control the code image analyzer to acquire network information from the captured code image; determine whether the code image is generated in a licensed program based on the code image generation information by confirming the name and the version of the automatic connection program, in response to determining that the code image is generated in the licensed program, control the communication unit to establish the wireless network connection with the peripheral terminal, in response to determining that the code image is not generated in the licensed program, control the communication unit to stop a wireless network connection process with the peripheral terminal; and after establishing the wireless network connection with the peripheral terminal using the acquired network information, to automatically execute a program corresponding to the automatic execution program information.